A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Visio
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Performance / Velocity is bad



 
 
Thread Tools Display Modes
  #1  
Old April 29th, 2009, 02:23 PM posted to microsoft.public.visio.general
Bernd[_2_]
external usenet poster
 
Posts: 11
Default Performance / Velocity is bad

I have a For ... Next loop in VBA which changes the text of over 1000 Shapes
(TextShapes).
The time for that is about 13 seconds.
My processor is working with 25%.

Is it possible to save time?

Some commands I tried (before the For-Next-Loop), but it is not faster:
Application.PurgeUndo
Application.UndoEnabled = False

Application.ScreenUpdating = False
Application.ShowChanges = False

Application.ShowProgress = False

Application.DeferRecalc = False
Application.LiveDynamics = False

  #2  
Old April 29th, 2009, 05:10 PM posted to microsoft.public.visio.general
AlEdlund
external usenet poster
 
Posts: 468
Default Performance / Velocity is bad

how are you looping through your shapes?
al

"Bernd" wrote in message
...
I have a For ... Next loop in VBA which changes the text of over 1000
Shapes
(TextShapes).
The time for that is about 13 seconds.
My processor is working with 25%.

Is it possible to save time?

Some commands I tried (before the For-Next-Loop), but it is not faster:
Application.PurgeUndo
Application.UndoEnabled = False

Application.ScreenUpdating = False
Application.ShowChanges = False

Application.ShowProgress = False

Application.DeferRecalc = False
Application.LiveDynamics = False


  #3  
Old May 5th, 2009, 12:07 PM posted to microsoft.public.visio.general
Bernd[_2_]
external usenet poster
 
Posts: 11
Default Performance / Velocity is bad

Hello Al Edlund,

here the extraction of VBA:

For i = 1 To UBound(Komma_Shapes_ID)


ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text = Komma_Shapes_Inhalt(i)

Next i

"AlEdlund" wrote:

how are you looping through your shapes?
al

"Bernd" wrote in message
...
I have a For ... Next loop in VBA which changes the text of over 1000
Shapes
(TextShapes).
The time for that is about 13 seconds.
My processor is working with 25%.

Is it possible to save time?

Some commands I tried (before the For-Next-Loop), but it is not faster:
Application.PurgeUndo
Application.UndoEnabled = False

Application.ScreenUpdating = False
Application.ShowChanges = False

Application.ShowProgress = False

Application.DeferRecalc = False
Application.LiveDynamics = False


  #4  
Old May 11th, 2009, 10:32 AM posted to microsoft.public.visio.general
Bernd[_2_]
external usenet poster
 
Posts: 11
Default Performance / Velocity is bad

Yes, I realize.
in the String-Vector ...
....1. Komma_Shapes_Pages(i) there is the page of the shape
....2. Komma_Shapes_ID(i) there is the ID of the shape
....3. Komma_Shapes_Inhalt(i) there is the new text content for the shape

The first and the second vector I compute at the start of the document (only
one-time). The time for that is not important for me.
Before the loop the content of the third string vector is computing.
The time for that is not more then 1 second.

The problem is the loop (about 13seconds). This operation is often doing by
user.
Loop:
For i = 1 To UBound(Komma_Shapes_ID)
ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text = Komma_Shapes_Inhalt(i)
Next i



"AlEdlund" wrote:

you do realize that you are using the integer value (i) for both the page
and the shape array pointer within the page, right ?

al

"Bernd" wrote in message
...
Hello Al Edlund,

here the extraction of VBA:

For i = 1 To UBound(Komma_Shapes_ID)


ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text
= Komma_Shapes_Inhalt(i)

Next i

"AlEdlund" wrote:

how are you looping through your shapes?
al

"Bernd" wrote in message
...
I have a For ... Next loop in VBA which changes the text of over 1000
Shapes
(TextShapes).
The time for that is about 13 seconds.
My processor is working with 25%.

Is it possible to save time?

Some commands I tried (before the For-Next-Loop), but it is not faster:
Application.PurgeUndo
Application.UndoEnabled = False

Application.ScreenUpdating = False
Application.ShowChanges = False

Application.ShowProgress = False

Application.DeferRecalc = False
Application.LiveDynamics = False



  #5  
Old May 11th, 2009, 12:20 PM posted to microsoft.public.visio.general
AlEdlund
external usenet poster
 
Posts: 468
Default Performance / Velocity is bad

At a minimum I'd suggest you consider two loops

dim intPage as integer
dim intShape as integer

for intPage = 1 to page count
for intShape to shapes on page count
next intshape
next intpage

al


Bernd wrote:
Yes, I realize.
in the String-Vector ...
...1. Komma_Shapes_Pages(i) there is the page of the shape
...2. Komma_Shapes_ID(i) there is the ID of the shape
...3. Komma_Shapes_Inhalt(i) there is the new text content for the shape

The first and the second vector I compute at the start of the document (only
one-time). The time for that is not important for me.
Before the loop the content of the third string vector is computing.
The time for that is not more then 1 second.

The problem is the loop (about 13seconds). This operation is often doing by
user.
Loop:
For i = 1 To UBound(Komma_Shapes_ID)
ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text = Komma_Shapes_Inhalt(i)
Next i



"AlEdlund" wrote:

you do realize that you are using the integer value (i) for both the page
and the shape array pointer within the page, right ?

al

"Bernd" wrote in message
...
Hello Al Edlund,

here the extraction of VBA:

For i = 1 To UBound(Komma_Shapes_ID)


ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text
= Komma_Shapes_Inhalt(i)

Next i

"AlEdlund" wrote:

how are you looping through your shapes?
al

"Bernd" wrote in message
...
I have a For ... Next loop in VBA which changes the text of over 1000
Shapes
(TextShapes).
The time for that is about 13 seconds.
My processor is working with 25%.

Is it possible to save time?

Some commands I tried (before the For-Next-Loop), but it is not faster:
Application.PurgeUndo
Application.UndoEnabled = False

Application.ScreenUpdating = False
Application.ShowChanges = False

Application.ShowProgress = False

Application.DeferRecalc = False
Application.LiveDynamics = False

  #6  
Old May 12th, 2009, 09:31 AM posted to microsoft.public.visio.general
Bernd[_2_]
external usenet poster
 
Posts: 11
Default Performance / Velocity is bad

No, I don't need this. All the Information which pages and which shapes
should change are in the 2 string vectors
1. Komma_Shapes_Pages()
2. Komma_Shapes_ID()

REDUCED example:
' -------------------------------------------------
'Shapes on Page 1:
Komma_Shapes_Pages(1) = 1
Komma_Shapes_ID(1) = 1

Komma_Shapes_Pages(2) = 1
Komma_Shapes_ID(2) = 2
....
....
'Shapes on page 2:
Komma_Shapes_Pages(800) = 2
Komma_Shapes_ID(800) = 1
....
....
-----------------------------------------------------

I don't like a loop over all pages/shapes, because only ca. 5% of all shapes
should
be changed.

The background is a process flow diagramm with some (over 1000) text shapes
with the values of the measurements of the process. The user can read a data
set of measurements from the DB for these shapes. There are many other shapes
like a pipe or a vessel which are static and never change.




"AlEdlund" wrote:

At a minimum I'd suggest you consider two loops

dim intPage as integer
dim intShape as integer

for intPage = 1 to page count
for intShape to shapes on page count
next intshape
next intpage

al


Bernd wrote:
Yes, I realize.
in the String-Vector ...
...1. Komma_Shapes_Pages(i) there is the page of the shape
...2. Komma_Shapes_ID(i) there is the ID of the shape
...3. Komma_Shapes_Inhalt(i) there is the new text content for the shape

The first and the second vector I compute at the start of the document (only
one-time). The time for that is not important for me.
Before the loop the content of the third string vector is computing.
The time for that is not more then 1 second.

The problem is the loop (about 13seconds). This operation is often doing by
user.
Loop:
For i = 1 To UBound(Komma_Shapes_ID)
ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text = Komma_Shapes_Inhalt(i)
Next i



"AlEdlund" wrote:

you do realize that you are using the integer value (i) for both the page
and the shape array pointer within the page, right ?

al

"Bernd" wrote in message
...
Hello Al Edlund,

here the extraction of VBA:

For i = 1 To UBound(Komma_Shapes_ID)


ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text
= Komma_Shapes_Inhalt(i)

Next i

"AlEdlund" wrote:

how are you looping through your shapes?
al

"Bernd" wrote in message
...
I have a For ... Next loop in VBA which changes the text of over 1000
Shapes
(TextShapes).
The time for that is about 13 seconds.
My processor is working with 25%.

Is it possible to save time?

Some commands I tried (before the For-Next-Loop), but it is not faster:
Application.PurgeUndo
Application.UndoEnabled = False

Application.ScreenUpdating = False
Application.ShowChanges = False

Application.ShowProgress = False

Application.DeferRecalc = False
Application.LiveDynamics = False


  #7  
Old May 12th, 2009, 01:10 PM posted to microsoft.public.visio.general
AlEdlund
external usenet poster
 
Posts: 468
Default Performance / Velocity is bad

The reason I was suggesting that you move to two loops was to reduce the
amount of time that Visio has to spend moving back and forth between
pages, since I don't know if you sort the pages array.
al


Bernd wrote:
No, I don't need this. All the Information which pages and which shapes
should change are in the 2 string vectors
1. Komma_Shapes_Pages()
2. Komma_Shapes_ID()

REDUCED example:
' -------------------------------------------------
'Shapes on Page 1:
Komma_Shapes_Pages(1) = 1
Komma_Shapes_ID(1) = 1

Komma_Shapes_Pages(2) = 1
Komma_Shapes_ID(2) = 2
...
...
'Shapes on page 2:
Komma_Shapes_Pages(800) = 2
Komma_Shapes_ID(800) = 1
...
...
-----------------------------------------------------

I don't like a loop over all pages/shapes, because only ca. 5% of all shapes
should
be changed.

The background is a process flow diagramm with some (over 1000) text shapes
with the values of the measurements of the process. The user can read a data
set of measurements from the DB for these shapes. There are many other shapes
like a pipe or a vessel which are static and never change.




"AlEdlund" wrote:

At a minimum I'd suggest you consider two loops

dim intPage as integer
dim intShape as integer

for intPage = 1 to page count
for intShape to shapes on page count
next intshape
next intpage

al


Bernd wrote:
Yes, I realize.
in the String-Vector ...
...1. Komma_Shapes_Pages(i) there is the page of the shape
...2. Komma_Shapes_ID(i) there is the ID of the shape
...3. Komma_Shapes_Inhalt(i) there is the new text content for the shape

The first and the second vector I compute at the start of the document (only
one-time). The time for that is not important for me.
Before the loop the content of the third string vector is computing.
The time for that is not more then 1 second.

The problem is the loop (about 13seconds). This operation is often doing by
user.
Loop:
For i = 1 To UBound(Komma_Shapes_ID)
ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text = Komma_Shapes_Inhalt(i)
Next i



"AlEdlund" wrote:

you do realize that you are using the integer value (i) for both the page
and the shape array pointer within the page, right ?

al

"Bernd" wrote in message
...
Hello Al Edlund,

here the extraction of VBA:

For i = 1 To UBound(Komma_Shapes_ID)


ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text
= Komma_Shapes_Inhalt(i)

Next i

"AlEdlund" wrote:

how are you looping through your shapes?
al

"Bernd" wrote in message
...
I have a For ... Next loop in VBA which changes the text of over 1000
Shapes
(TextShapes).
The time for that is about 13 seconds.
My processor is working with 25%.

Is it possible to save time?

Some commands I tried (before the For-Next-Loop), but it is not faster:
Application.PurgeUndo
Application.UndoEnabled = False

Application.ScreenUpdating = False
Application.ShowChanges = False

Application.ShowProgress = False

Application.DeferRecalc = False
Application.LiveDynamics = False

  #8  
Old May 12th, 2009, 01:31 PM posted to microsoft.public.visio.general
Bernd[_2_]
external usenet poster
 
Posts: 11
Default Performance / Velocity is bad

Yes, the pages array is sorted (Komma_Shapes_Pages()).
There are no unnecessary moves between the pages.
Have You an advise to faster the procedure?

"AlEdlund" wrote:

The reason I was suggesting that you move to two loops was to reduce the
amount of time that Visio has to spend moving back and forth between
pages, since I don't know if you sort the pages array.
al


Bernd wrote:
No, I don't need this. All the Information which pages and which shapes
should change are in the 2 string vectors
1. Komma_Shapes_Pages()
2. Komma_Shapes_ID()

REDUCED example:
' -------------------------------------------------
'Shapes on Page 1:
Komma_Shapes_Pages(1) = 1
Komma_Shapes_ID(1) = 1

Komma_Shapes_Pages(2) = 1
Komma_Shapes_ID(2) = 2
...
...
'Shapes on page 2:
Komma_Shapes_Pages(800) = 2
Komma_Shapes_ID(800) = 1
...
...
-----------------------------------------------------

I don't like a loop over all pages/shapes, because only ca. 5% of all shapes
should
be changed.

The background is a process flow diagramm with some (over 1000) text shapes
with the values of the measurements of the process. The user can read a data
set of measurements from the DB for these shapes. There are many other shapes
like a pipe or a vessel which are static and never change.




"AlEdlund" wrote:

At a minimum I'd suggest you consider two loops

dim intPage as integer
dim intShape as integer

for intPage = 1 to page count
for intShape to shapes on page count
next intshape
next intpage

al


Bernd wrote:
Yes, I realize.
in the String-Vector ...
...1. Komma_Shapes_Pages(i) there is the page of the shape
...2. Komma_Shapes_ID(i) there is the ID of the shape
...3. Komma_Shapes_Inhalt(i) there is the new text content for the shape

The first and the second vector I compute at the start of the document (only
one-time). The time for that is not important for me.
Before the loop the content of the third string vector is computing.
The time for that is not more then 1 second.

The problem is the loop (about 13seconds). This operation is often doing by
user.
Loop:
For i = 1 To UBound(Komma_Shapes_ID)
ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text = Komma_Shapes_Inhalt(i)
Next i



"AlEdlund" wrote:

you do realize that you are using the integer value (i) for both the page
and the shape array pointer within the page, right ?

al

"Bernd" wrote in message
...
Hello Al Edlund,

here the extraction of VBA:

For i = 1 To UBound(Komma_Shapes_ID)


ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text
= Komma_Shapes_Inhalt(i)

Next i

"AlEdlund" wrote:

how are you looping through your shapes?
al

"Bernd" wrote in message
...
I have a For ... Next loop in VBA which changes the text of over 1000
Shapes
(TextShapes).
The time for that is about 13 seconds.
My processor is working with 25%.

Is it possible to save time?

Some commands I tried (before the For-Next-Loop), but it is not faster:
Application.PurgeUndo
Application.UndoEnabled = False

Application.ScreenUpdating = False
Application.ShowChanges = False

Application.ShowProgress = False

Application.DeferRecalc = False
Application.LiveDynamics = False


  #9  
Old May 12th, 2009, 01:58 PM posted to microsoft.public.visio.general
AlEdlund
external usenet poster
 
Posts: 468
Default Performance / Velocity is bad

Based on that it sounds like you already have done what needs to be
accomplished,
:-(
al


Bernd wrote:
Yes, the pages array is sorted (Komma_Shapes_Pages()).
There are no unnecessary moves between the pages.
Have You an advise to faster the procedure?

"AlEdlund" wrote:

The reason I was suggesting that you move to two loops was to reduce the
amount of time that Visio has to spend moving back and forth between
pages, since I don't know if you sort the pages array.
al


Bernd wrote:
No, I don't need this. All the Information which pages and which shapes
should change are in the 2 string vectors
1. Komma_Shapes_Pages()
2. Komma_Shapes_ID()

REDUCED example:
' -------------------------------------------------
'Shapes on Page 1:
Komma_Shapes_Pages(1) = 1
Komma_Shapes_ID(1) = 1

Komma_Shapes_Pages(2) = 1
Komma_Shapes_ID(2) = 2
...
...
'Shapes on page 2:
Komma_Shapes_Pages(800) = 2
Komma_Shapes_ID(800) = 1
...
...
-----------------------------------------------------

I don't like a loop over all pages/shapes, because only ca. 5% of all shapes
should
be changed.

The background is a process flow diagramm with some (over 1000) text shapes
with the values of the measurements of the process. The user can read a data
set of measurements from the DB for these shapes. There are many other shapes
like a pipe or a vessel which are static and never change.




"AlEdlund" wrote:

At a minimum I'd suggest you consider two loops

dim intPage as integer
dim intShape as integer

for intPage = 1 to page count
for intShape to shapes on page count
next intshape
next intpage

al


Bernd wrote:
Yes, I realize.
in the String-Vector ...
...1. Komma_Shapes_Pages(i) there is the page of the shape
...2. Komma_Shapes_ID(i) there is the ID of the shape
...3. Komma_Shapes_Inhalt(i) there is the new text content for the shape

The first and the second vector I compute at the start of the document (only
one-time). The time for that is not important for me.
Before the loop the content of the third string vector is computing.
The time for that is not more then 1 second.

The problem is the loop (about 13seconds). This operation is often doing by
user.
Loop:
For i = 1 To UBound(Komma_Shapes_ID)
ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text = Komma_Shapes_Inhalt(i)
Next i



"AlEdlund" wrote:

you do realize that you are using the integer value (i) for both the page
and the shape array pointer within the page, right ?

al

"Bernd" wrote in message
...
Hello Al Edlund,

here the extraction of VBA:

For i = 1 To UBound(Komma_Shapes_ID)


ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text
= Komma_Shapes_Inhalt(i)

Next i

"AlEdlund" wrote:

how are you looping through your shapes?
al

"Bernd" wrote in message
...
I have a For ... Next loop in VBA which changes the text of over 1000
Shapes
(TextShapes).
The time for that is about 13 seconds.
My processor is working with 25%.

Is it possible to save time?

Some commands I tried (before the For-Next-Loop), but it is not faster:
Application.PurgeUndo
Application.UndoEnabled = False

Application.ScreenUpdating = False
Application.ShowChanges = False

Application.ShowProgress = False

Application.DeferRecalc = False
Application.LiveDynamics = False

  #10  
Old May 13th, 2009, 07:47 AM posted to microsoft.public.visio.general
Bernd[_2_]
external usenet poster
 
Posts: 11
Default Performance / Velocity is bad

anyway thanks for your efforts
Bernd

"AlEdlund" wrote:

Based on that it sounds like you already have done what needs to be
accomplished,
:-(
al


Bernd wrote:
Yes, the pages array is sorted (Komma_Shapes_Pages()).
There are no unnecessary moves between the pages.
Have You an advise to faster the procedure?

"AlEdlund" wrote:

The reason I was suggesting that you move to two loops was to reduce the
amount of time that Visio has to spend moving back and forth between
pages, since I don't know if you sort the pages array.
al


Bernd wrote:
No, I don't need this. All the Information which pages and which shapes
should change are in the 2 string vectors
1. Komma_Shapes_Pages()
2. Komma_Shapes_ID()

REDUCED example:
' -------------------------------------------------
'Shapes on Page 1:
Komma_Shapes_Pages(1) = 1
Komma_Shapes_ID(1) = 1

Komma_Shapes_Pages(2) = 1
Komma_Shapes_ID(2) = 2
...
...
'Shapes on page 2:
Komma_Shapes_Pages(800) = 2
Komma_Shapes_ID(800) = 1
...
...
-----------------------------------------------------

I don't like a loop over all pages/shapes, because only ca. 5% of all shapes
should
be changed.

The background is a process flow diagramm with some (over 1000) text shapes
with the values of the measurements of the process. The user can read a data
set of measurements from the DB for these shapes. There are many other shapes
like a pipe or a vessel which are static and never change.




"AlEdlund" wrote:

At a minimum I'd suggest you consider two loops

dim intPage as integer
dim intShape as integer

for intPage = 1 to page count
for intShape to shapes on page count
next intshape
next intpage

al


Bernd wrote:
Yes, I realize.
in the String-Vector ...
...1. Komma_Shapes_Pages(i) there is the page of the shape
...2. Komma_Shapes_ID(i) there is the ID of the shape
...3. Komma_Shapes_Inhalt(i) there is the new text content for the shape

The first and the second vector I compute at the start of the document (only
one-time). The time for that is not important for me.
Before the loop the content of the third string vector is computing.
The time for that is not more then 1 second.

The problem is the loop (about 13seconds). This operation is often doing by
user.
Loop:
For i = 1 To UBound(Komma_Shapes_ID)
ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text = Komma_Shapes_Inhalt(i)
Next i



"AlEdlund" wrote:

you do realize that you are using the integer value (i) for both the page
and the shape array pointer within the page, right ?

al

"Bernd" wrote in message
...
Hello Al Edlund,

here the extraction of VBA:

For i = 1 To UBound(Komma_Shapes_ID)


ThisDocument.Pages(Komma_Shapes_Pages(i)).Shapes.I temFromID(Komma_Shapes_ID(i)).Text
= Komma_Shapes_Inhalt(i)

Next i

"AlEdlund" wrote:

how are you looping through your shapes?
al

"Bernd" wrote in message
...
I have a For ... Next loop in VBA which changes the text of over 1000
Shapes
(TextShapes).
The time for that is about 13 seconds.
My processor is working with 25%.

Is it possible to save time?

Some commands I tried (before the For-Next-Loop), but it is not faster:
Application.PurgeUndo
Application.UndoEnabled = False

Application.ScreenUpdating = False
Application.ShowChanges = False

Application.ShowProgress = False

Application.DeferRecalc = False
Application.LiveDynamics = False


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.