Jump to content

Entity Processing


abraxus

Recommended Posts

I was interested to know what is faster at processing Autocad entities (things like deleting objects, comparing objects, writing to an external database)

 

I realize my question is not quite clearly defined, but I thought someone here might know based on experience - i have only worked with lisp and vba in autocad (i have .NET experience, but not in Autocad)

 

I assume it works like this

 

LISP (kinda-fast)

VBA (fast)

ObjectARC (faster)

.NET (fastest)

 

is that fairly accurate?

Link to comment
Share on other sites

I think there are mixed reviews regarding the relative speed of VBA and Lisp. Coding method play a large part; For instance an AutoLisp entity creation via Command (slower) call versus Entmake (faster) straddles the speed of a VBA Object.AddEntity.

 

I think one undisputed statement, though - ObjectARX is the speed king.

 

I would definitely recommend investigating the ManagedARX API, if you have prior experience with one of the languages. DotNet produces speedier code, as well as offering a much more extensive tool set. Developing the code for any specific task tends to be more time consuming, but the end result makes the effort worthwhile.

Link to comment
Share on other sites

1+... Well said! :thumbsup:

 

 

 

Here's a series of DevBlog articles, by a now former ADN Team member, that seem relevant:

 

 

 

The Right Tools for the Job – AutoCAD Part 1

 

The Right Tools for the Job – AutoCAD Part 2

 

The Right Tools for the Job – AutoCAD Part 3

 

The Right Tools for the Job – AutoCAD Part 4

 

 

 

... Here's an excerpt from Part 3:

 

...

 

Enough details, let’s look at some data.

 

6a0167607c2431970b017616975e7d970c-pi

 

As I mentioned, there were three data storage categories that I ran my tests on:

 

  1. Creating a Dictionary entry and storing an XRecord to it
  2. Creating a Dictionary entry and and storing a Custom Object to it
  3. Creating a Dictionary entry and storing XData to it

 

I created sample code for each language and ran them for 1 million cycles (performing the same operation 1 million times) with a timer routine which timed the whole process.

 

You’ll notice in the above slide that I have missed out the VB6/VBA (Out of Process) results – this is because they are *so* much slower than ObjectARX, .NET, VBA (In process) and LISP that if I were to apply the data to this slide you wouldn’t even see ObjectARX or .NET data showing up on the scale!

 

Check out why VBA developers needed to migrate their applications to VB.NET using COM Interop if they want to run on 64bit!

 

6a0167607c2431970b017616976738970c-800wi

 

Of course, all of my tests showed that ObjectARX was significantly faster than all the other languages, no surprise there. That said, you can now clearly see why I don’t use Transactions in any of my sample code, it’s slower than Open/Close for both .NET and ObjectARX. I’ll dig into why this is in a later post.

 

What I found really surprising, is how well VBA (In Process 32bit) and LISP performed. Yes, .NET is about 5 times faster for this specific test benchmark, but considering that the time is only 75-80 seconds for 1,000,000 records, that’s pretty impressive. Looking into why this is happening, I can see that the reason is that most of the work is actually done under the hood by AutoCAD (C++ code), reinforcing my earlier point that it really depends on what you are doing whether you see dramatic (or not) resulting time differences.

 

The specific Xdata test I ran though, in my opinion, is not really a good real life benchmark because generally speaking Xdata will not be attached to a Dictionary entry that we just created. So I decided to run a pure test against attaching Xdata to an existing object. Surprisingly in my tests, attaching Xdata to an existing entity only gave slightly better results for .NET and ObjectARX 8 seconds instead of 9 for ObjectARX and 14 seconds instead of 15.

 

...

 

Cheers

Link to comment
Share on other sites

excellent post...

 

since i know nothing about objectARX, where do you people suggest i start learning? i assume it is at least similar to VBA and lets you draw forms and add actions to buttons and such, right?

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...