2011 VERY slow lisp performance!
Hi there,
few days ago we have switched from 2008 to 2011 version of autocad. Now we are experiencing very slow performances on our automated drafting programs. such as one of our program which has been usually finishing in 10 seconds (reading data from file, calculating and drawing polylines text and hatch objects) now takes over 4 minutes to complete!!
program is compiled to vlx and contains routines with basic coding including "command" "entmake" and numerous vl* functions aswell. I have switched off every helper like osnap, polar, grid, viewcube, ribbon etc..
it seems that something has changed fundementally but what is it? please help I'm really disapointed begining day one with 2011. thanks in advance.
edit: if the lisp drawing operation is visible on the screen it is slow. If drawing takes place out of the visible area (such as zooming in too much or panning the screen out of visible area) lisp operates faster.
I hope someone out there point out a system variable to fix this behaviour :)
Re: 2011 VERY slow lisp performance!
If your routine is written in Visual Lisp, try to switch from Model Space to Paper Space in start of routine and in the end switch it back to Model Space... Use (setvar 'tilemode 0) and (setvar 'tilemode 1) for switching between Spaces... This way you avoid zooming and unnecessary operations that may even cause wrong result of lisp execution and not to mention slower times of its termination...
Hope this helps...
M.R.
Re: 2011 VERY slow lisp performance!
Well, if I switch to paperspace the drawing operation takes place in paperspace aswell and there again it is slow.
It appears to be there has been a change in graphics subsystem since version 2008. and unfortunately it causes a major speed issue in rendering performance of object creation with lisp.
Re: 2011 VERY slow lisp performance!
The operations should be executed in Model Space while interface is switched to Paper Space without viewports - erase all objects in Paper Space, and in the end you should switch to Model Space back and see the result... Use Model Space for creating objects, and for manipulations use Paper Space - for getting objects from Model Space use (ssget (list (cons 410 "Model")))
This is as much as I know, but if creation of objects is too slow, try to free memory space by resetting all variables to nil - start new cad session, and if variables become too complex during lisp execution try too free them as soon as possible, within lisp - set them to nil...
Re: 2011 VERY slow lisp performance!
I got the point and tried the method you suggested but problem remains regardless of the space I'm working in.. whether in paper or model (or model inside the paper).
memory or complexity of the variables have never been an issue in 2008 further more lisp routine is heavy on the drawing side, it does not involve complex calculations or huge lists..
Re: 2011 VERY slow lisp performance!
Also, if you haven't disable Selection Cycling from DSETTINGS command - most right menu bar, do it, for it has to do with speed of drawing and normal use of CAD...
Re: 2011 VERY slow lisp performance!
I've tried turning them selectively on&off every combination (those drafting helper items like grid, polar, snap all of them) as you mentioned but nothing changed.
I'll try to isolate the troubling function which slows down the whole thing and try to spot whether its "command" or "vl-cmdf" or "entmake" or whatever it is. I'll share my findings later on.
Re: 2011 VERY slow lisp performance!
There is likely a system variable that you have set for 2008 that is set differently in 2011. You will have to check the source code to see where the actual problem is, you can't do detailed bug hunting with a VLX file.
Its also likely that the routines need optimization.
Re: 2011 VERY slow lisp performance!
Do you have the most recent Update for AutoCAD 2011 installed?
Re: 2011 VERY slow lisp performance!
yes the update installed while setting up Autocad for the first time.
can you please do me a favor and run the code below and report the elapsed timer results that you will get. I'm executing the code on a p4 3.2 ghz computer,
autocad 2008 execution invisible: Elapsed timer (on): 0 days 00:00:00:953
autocad 2008 execution visible: Elapsed timer (on): 0 days 00:00:01:062
autocad 2011 execution invisible: Elapsed timer (on): 0 days 00:00:01:219
autocad 2011 execution visible: Elapsed timer (on): 0 days 00:00:19:531
Code:
(defun c:perf()
(vl-cmdf "'time" "r" "")
(setq i 0 p0 (list 0 0) p1 (list 0 1000))
(repeat 1000
(setq p0 (list (* i 150) 0) p1 (list (* i 150) 1000) )
(vl-cmdf "pline" p0 "w" "10" "10" p1 "" )
(setq i (1+ i))
)
(vl-cmdf "'time" "d" "")
(princ)
)