VBA on ACAD 2008 64-bit

VBA on ACAD 2008 64-bit

Anonymous
Not applicable
1,019 Views
15 Replies
Message 1 of 16

VBA on ACAD 2008 64-bit

Anonymous
Not applicable
Has anyone else done any testing on VBA modules running on ACAD2008 64-bit?

I have tested a small routine that takes less than a second to run on
2007 and earlier - and it is taking 7-9 seconds to run in the 64-bit
test machine.

I know that it's running through some sort of 32-bit emulator, but 7X to
9X slower is more than I expected. Can't wait to test a more complex
application....



--
R.K. McSwain
http://rkmcswain.blogspot.com
0 Likes
1,020 Views
15 Replies
Replies (15)
Message 2 of 16

Anonymous
Not applicable
we're getting 2k8 in the middle of this month ... i guess its time to start learning .NET ... like fast! 😕
0 Likes
Message 3 of 16

Anonymous
Not applicable
32 or 64 version?
0 Likes
Message 4 of 16

Anonymous
Not applicable
The reason is that it is running out of process. Am I correct in presuming the 64 bit version still does not contain VSTA.

From Between The Lines:

Do AutoCAD 2004/2005/2006/2007 third-party applications work with AutoCAD 2008 64-bit?
Third-party add-on applications based on Visual LISP or AutoLISP for AutoCAD 2004/2005/2006/2007 will work on AutoCAD 2008 64-bit. Autodesk has developed an out-of-process interim solution for customers who want to use VBA on 64-bit AutoCAD. Long-term customers will be required to port the VBA applications to VSTA when using 64-bit AutoCAD. Third-party add-on applications based on VBA for AutoCAD 2007 will run out of process on AutoCAD 2008 64-bit. VBA based applications for AutoCAD 2004/2006/2005 may run out of process in some instances but may need to be modified in other instances. For more details on AutoCAD 2005/2006 VBA compatibility, please refer to www.autodesk.com/developautocad.
0 Likes
Message 5 of 16

Anonymous
Not applicable
Nathan Taylor said the following On 4/2/2007 5:51 PM:
> The reason is that it is running out of process. Am I correct in presuming the 64 bit version still does not contain VSTA.

Yes, I know the reason. What I was saying is that I didn't figure it
would be *that* much slower.

I'm working on a test using a much more complex VBA routine. I'm not
sure the first routine (tiny) was a fair test.

--
R.K. McSwain
http://rkmcswain.blogspot.com
0 Likes
Message 6 of 16

Anonymous
Not applicable
R.K. McSwain,

My app uses a vba dvb to call a vb6 dll.

Can you do a test with me with early binding and late binding?

I am curious if starting your vb6 app with vba has implications and where or not late binding may fix it.

Give me a call if you have a few minutes to try out some sample apps and do a benchmark.
http://www.construction3d.com/Contact.html

Thanks,

Dave
0 Likes
Message 7 of 16

Anonymous
Not applicable
You said it was because it was running some kind of emulator the reason I pointed out is the same reason as why stand alone VB applications run slower than VBA.

Does 64 bit AutoCAD contain VSTA? The product information does not say so but the info on Between The Lines indicates that it possibly does.

Regards - Nathan
0 Likes
Message 8 of 16

Anonymous
Not applicable
R.K. McSwain wrote:

> I'm working on a test using a much more complex VBA routine. I'm not
> sure the first routine (tiny) was a fair test.

I just confirmed your findings. I have a VBA routine that creates a
large number of entities. It was taking less than a second on
2008/WinXP32, it takes over 10sec on 2008/Vista64 (on a faster machine).

The marshaling on out of process is a killer!

Fortunately for now (for me) is that the vast majority of people are
running 32bit.

Terry
0 Likes
Message 9 of 16

Anonymous
Not applicable
I suppose it’s time for the VBA’ers to start learning a more viable language such as Visual Lisp. I suppose it will out perform VBA by an order of magnitude on 64bit machines.
0 Likes
Message 10 of 16

jbooth
Advocate
Advocate
lisp is legacy. Autodesk is pushing for people to use their .NET wrapper classes that encapsulate their arx libraries.
0 Likes
Message 11 of 16

Anonymous
Not applicable
Hello,
I bring back an old thread because I'm having problems with this issue in these days and you could help me.
I have noticed too a different speed of execution of the routines under 2008-x64 because of the x64VbaServer external process.
My problem, though, is not exactly in the routines: they are pretty simple and there's not a big difference of speed in executing them. My biggest problem is that when the external process is loaded, normal commands like copy&paste, or mirror, or erase, takes much more time than usual (i.e. 5 seconds on 2007, more than one minute on 2008).
I guess that the problem relies in the events handling of VBA process: also if nothing is written in the AcadDocument events subroutines, it always check them. But being so slow in doing them, when you work on many objects it takes an unbelievable amount of time.
Anyone else has the same problem?
0 Likes
Message 12 of 16

Anonymous
Not applicable
If you're using 64 bit VBA, you will take a massive performance hit if your VBA code handles events.

It doesn't matter if you're handling only one event (like for example, BeginSave or whatever its called), or several, you will still suffer a massive hit if you use WithEvents on an AcadDocument or an AcadApplication variable.

The reason for that is related to how ActiveX events work. An ActiveX server doesn't know what specific events a client is handling. It only knows that the client wants all events for a given interface.

So, when you declare an AcadDocument using the WithEvents keyword, you are telling AutoCAD that it should fire *all* document events, not only those you wrote handlers for, and that's exactly it does.

For the events that you do not have handlers for in your code, VBA generates 'empty' or 'do-nothing' event handlers to handle those events.

The three events which are major contributors to slowing down everything you do, are these:

ObjectModified
ObjectAdded
ObjectErased

These events fire at a very high frequency, because they are object-specific. For example, if you draw a circle, the ObjectAdded event fires for the circle, then the ObjectModified event fires for the circle, and then the ObjectModified event fires for the circle's owner (the block that the circle was added to, like AcadModelSpace). So for each object added to a drawing you will have three inter-process ActiveX calls, which sends performance right through the floor.

So, if you're using 64 bit VBA and are seeing significant, across-the-board performance degredation, the odds are that it's a result of handling AcadDocument and/or AcadApplication events.

I'm afraid there's no solution for that.

My advice is to start learning .NET. The good thing about it is that you can continue to use ActiveX in .NET (similar to using VBA), until you're comfortable with the managed API.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5794218@discussion.autodesk.com...
Hello,
I bring back an old thread because I'm having problems with this issue in these days and you could help me.
I have noticed too a different speed of execution of the routines under 2008-x64 because of the x64VbaServer external process.
My problem, though, is not exactly in the routines: they are pretty simple and there's not a big difference of speed in executing them. My biggest problem is that when the external process is loaded, normal commands like copy&paste, or mirror, or erase, takes much more time than usual (i.e. 5 seconds on 2007, more than one minute on 2008).
I guess that the problem relies in the events handling of VBA process: also if nothing is written in the AcadDocument events subroutines, it always check them. But being so slow in doing them, when you work on many objects it takes an unbelievable amount of time.
Anyone else has the same problem?
0 Likes
Message 13 of 16

Anonymous
Not applicable
Thanks for the answer. It's very interesting and useful.
I had another question: why the events are handled also if I have no .dvb projects loaded in my Autocad session? The external process run also if i just do a VBALOAD and then I don't charge any VBA files.
And in my application, anyway, I don't handle any of the AcadDocument events.
Is there a way to blocks the event's handling of VBA from the external process?

Dave
0 Likes
Message 14 of 16

Anonymous
Not applicable
Does your app handle any events at all, or use 'WithEvents'
on any AutoCAD object variables?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5796868@discussion.autodesk.com...
Thanks for the answer. It's very interesting and useful.
I had another question: why the events are handled also if I have no .dvb projects loaded in my Autocad session? The external process run also if i just do a VBALOAD and then I don't charge any VBA files.
And in my application, anyway, I don't handle any of the AcadDocument events.
Is there a way to blocks the event's handling of VBA from the external process?

Dave
0 Likes
Message 15 of 16

Anonymous
Not applicable
>Reply From: Tony Tanzillo
>Date: Dec/11/07 - 19:45 (GMT)

>Re: VBA on ACAD 2008 64-bit
>Does your app handle any events at all, or use 'WithEvents'
>on any AutoCAD object variables?

I use only object variables, but I have the same problem also if my application is NOT loaded. It's enough to execute the VBALOAD command, then click CANCEL without charging any DVB files, and the out-process will run. And then, the performances will go down.

Dave
0 Likes
Message 16 of 16

Anonymous
Not applicable
If that's the case, then AutoCAD itself is causing
some IPC that cannot be avoided at all.

VBA on 64 bit AutoCAD is clearly a lost cause.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5799044@discussion.autodesk.com...
>Reply From: Tony Tanzillo
>Date: Dec/11/07 - 19:45 (GMT)

>Re: VBA on ACAD 2008 64-bit
>Does your app handle any events at all, or use 'WithEvents'
>on any AutoCAD object variables?

I use only object variables, but I have the same problem also if my application is NOT loaded. It's enough to execute the VBALOAD command, then click CANCEL without charging any DVB files, and the out-process will run. And then, the performances will go down.

Dave
0 Likes