After doing everything within my known power to 'trim the fat' from this lisp, it gets close, but still not better. This is the best I can get:
Elapsed milliseconds / relative speed for 1024 iteration(s):
(_VLA-ADDHATCH SP (vlax-ename->vla-o...).....1688 / 1.20 <fastest>
(ENTMAKEX-HATCH E 0.0 "ANSI31" 1.0)..........2031 / 1.00 <slowest>
..............................
Elapsed milliseconds / relative speed for 1024 iteration(s):
(_VLA-ADDHATCH SP (vlax-ename->vla-o...).....1672 / 1.11 <fastest>
(ENTMAKEX-HATCH E 0.0 "ANSI31" 1.0)..........1859 / 1.00 <slowest>
..............................
Elapsed milliseconds / relative speed for 1024 iteration(s):
(_VLA-ADDHATCH SP (vlax-ename->vla-o...).....1688 / 1.12 <fastest>
(ENTMAKEX-HATCH E 0.0 "ANSI31" 1.0)..........1891 / 1.00 <slowest>
...since the visual lisp method only hatches one entity, I modified the entmakex portion to also only accept one entity. Then rearranged some stuff, removed some stuff, and that's your result. I have attached the lisp. Also, it is worth noting that I am now under the assumption that, in this case, the foreach statement will run faster than mapcar/lambda.
EDIT /// HOLD THE PHONES..!..!..!..
Check out what happens when I switch these two...
(benchmark '((_vla-addhatch sp (vlax-ename->vla-object e) "ANSI31" 0.0 1.0)
(entmakex-hatch e 0.0 "ANSI31" 1.0)
)
......... to ..........
(benchmark '((entmakex-hatch e 0.0 "ANSI31" 1.0)
(_vla-addhatch sp (vlax-ename->vla-object e) "ANSI31" 0.0 1.0)
)
Elapsed milliseconds / relative speed for 2048 iteration(s):
(ENTMAKEX-HATCH E 0.0 "ANSI31" 1.0)..........3687 / 1.26 <fastest>
(_VLA-ADDHATCH SP (vlax-ename->vla-o...).....4641 / 1.00 <slowest>
.................
Elapsed milliseconds / relative speed for 2048 iteration(s):
(ENTMAKEX-HATCH E 0.0 "ANSI31" 1.0)..........3735 / 1.24 <fastest>
(_VLA-ADDHATCH SP (vlax-ename->vla-o...).....4641 / 1.00 <slowest>
.................
Elapsed milliseconds / relative speed for 2048 iteration(s):
(ENTMAKEX-HATCH E 0.0 "ANSI31" 1.0)..........3719 / 1.26 <fastest>
(_VLA-ADDHATCH SP (vlax-ename->vla-o...).....4703 / 1.00 <slowest>
... IT'S A CONSPIRACY! Lol, now we gotta delete this benchmark. ¯\_(ツ)_/¯
Best,
~DD