.Net call or lisp entget

.Net call or lisp entget

StormyC
Advocate Advocate
1,066 Views
5 Replies
Message 1 of 6

.Net call or lisp entget

StormyC
Advocate
Advocate

I do not have time to write code to discover which is faster so I wondered if anyone knew.....

 

Task: To obtain the Handle to an entity as a string to be used in legacy lisp routines.

 

Which is likely to be faster;

 

(cdr(assoc 5(entget eName)))

 

OR

 

A call to a .net DLL that returns the handle of the entity eName.

 

Opinions anyone?

0 Likes
Accepted solutions (1)
1,067 Views
5 Replies
Replies (5)
Message 2 of 6

chiefbraincloud
Collaborator
Collaborator
Accepted solution

Use the LSP.  If all you need is a Handle, it would be silly to have to load a .dll to replace 3 lsp function calls.

Dave O.                                                                  Sig-Logos32.png
0 Likes
Message 3 of 6

StormyC
Advocate
Advocate

Agree, however, I already load a .net DLL that replaces other legacy routines - so the loading of the DLL isnt an issue.

 

Obtaining a handle occurs hundreds of times - so - question still stands... Lisp or .Net. =D

 

....can't rewrite all of the lisp routines in .net yet because of time constraints.

0 Likes
Message 4 of 6

chiefbraincloud
Collaborator
Collaborator

I still say, for this case, use the LSP.  For routines that you are converting from LSP to .NET, I would go ahead and convert them completely to use all .NET and no LSP, but for the particular case you presented, I do not think there would be a benefit to a .NET function to return the handle as a string.  On the contrary, I think it would result in more CPU instructions and memory read/writes rather than less.

 

Dave O.                                                                  Sig-Logos32.png
0 Likes
Message 5 of 6

dgorsman
Consultant
Consultant

The previous answer still stands 🙂  A couple of hundred calls to extracting a handle from an (entget...) list?  That won't get any faster with .NET.  If speed is critical and you keep pulling the same handles, then consider some optimization such as caching the handle values alongside the entity codes in a list of dotted pairs e.g. (<Ecode> . "Handle").

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 6 of 6

StormyC
Advocate
Advocate

Thanks for the responses guys, very much appreciated.

0 Likes