TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: d2010 on May 22, 2022, 03:17:52 AM
-
The subject=
"Change type-of-variabile("ent_list"), You do slow-down of speed too much?"
Hello..............
:police:=In other/s programmingLanguages ,if exists "change too many types of variabiles(not value)", you slow down of speed too much.(e.g php_array to integer).
:glarestraight:=Anyone can benchmark of speed "change variabile types?".
You can test any variabile type.
(Defun ent_makeText(pnt rotation / ent_list)
(setq ent_list(list
(cons 50 rotation)
(list 11 (car pnt) (cadr pnt) 0.0)
) ;_ end of list
) ;_ end of setq
(setq ent_list (entmakex ent_list))
)
(Defun dfn_var_type
(v391
/ ret a
) /*c2s:
a==nil,9;
0);
*/
ret)
-
Changing the type is, allocating new and destroying old memory.
Either way, it can be expensive computationally, but this shouldn’t be a real concern unless you’re dealing with millions of objects
-
Actually, what I said is not quite true. at least from an ARX perspective.
ads_u_val is a union that holds 192bits ...?....
So, in theory, if the item fits in the memory space, new memory may not be allocated.
I.e changing and int to a point won't require new memory allocation. changing and int to a string would be expensive