See the top rated post in this thread. Click here

Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 31

Thread: 2011 VERY slow lisp performance!

  1. #21
    Active Member
    Join Date
    2005-12
    Posts
    72
    Login to Give a bone
    0

    Default Re: 2011 VERY slow lisp performance!

    Mr. marko_ribar my cmdecho is "0" otherwise it takes too long to complete because of the text window refresh.

  2. #22
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: 2011 VERY slow lisp performance!

    Try this routine - it is your perf.lsp just converted to Visual Lisp
    (my times are now much much faster) :

    Code:
    (defun c:perf()
      (setq osm (getvar 'osmode))
      (setq cmde (getvar 'cmdecho))
      (setvar 'osmode 0)
      (setvar 'cmdecho 0)
      (vl-cmdf "'time" "r" "")
      (setq i 0 p0 (list 0 0 0) p1 (list 0 1000 0))
      (vl-load-com)
      (setq msp (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object))))
      (repeat 1000
        (setq p0 (list (* i 150) 0 0) p1 (list (* i 150) 1000 0) )
        (setq ptl (list p0 p1) )
        (setq ptl (apply 'append ptl))
        (setq pts (vlax-make-variant
                  (vlax-safearray-fill
                  (vlax-make-safearray vlax-vbdouble (cons 0 (1- (length ptl))))
                  ptl
                  )
                  )
        )
        (setq plin (vla-addpolyline msp pts))
        (vlax-put-Property plin 'ConstantWidth 10)
        (vla-update plin)
        (vlax-release-object plin)
        (setq i (1+ i))
      )
      (setvar 'osmode osm)
      (setvar 'cmdecho cmde)
      (vl-cmdf "'time" "d" "")
    (princ)
    )
    M.R.

    BTW, you can start perf.lsp from empty PaperSpace and time will be even faster, and in the end switch to ModelSpace to see result...

  3. #23
    Active Member
    Join Date
    2005-12
    Posts
    72
    Login to Give a bone
    0

    Default Re: 2011 VERY slow lisp performance!

    Honestly I don't like ActiveX method very much and don't prefer if I do not really need it. of course optimization is always an option but I would be very happy If only I could understand what causes 2011 (command method) to slow down??

    just try the entmake, simple and faster;

    Code:
    (defun c:perf()
      (vl-cmdf "'time" "r" "")
      (setq i 0 base (list (cons 0  "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 410 "Model")(cons 43 10.)(cons 90 2)))
      (repeat 1000
        (setq p0 (list (* i 150) 0) p1 (list (* i 150) 1000) )
        (entmake (append base (list  (cons 10 p0) (cons 10 p1))))
        (setq i (1+ i))
        )
      (vl-cmdf "'time" "d" "")
      (princ)
      )
    ps: beware that your polylines are old type, they are not LWpolyline.

  4. #24
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: 2011 VERY slow lisp performance!

    ok, perhaps I do not understand Visible/Invisible. The farther I zoom out, the slower the program seems to run. Then if I pan so the lines wont show up on the screen it reduces the time. But I cant seem to get it to run at 12 seconds no matter what. I'm at 5 seconds right now, zoomed way out (farther than I will ever be zoomed for any actual work)

    Code:
    Command: perf
    
    Current time:             Thursday, February 10, 2011  9:19:10:485 AM
    Times for this drawing:
      Created:                Thursday, February 10, 2011  9:17:36:746 AM
      Last updated:           Thursday, February 10, 2011  9:17:36:746 AM
      Total editing time:     0 days 00:01:33:763
      Elapsed timer (on):     0 days 00:00:05:076
      Next automatic save in: <disabled>
    
    Command: rea
    REGENALL Regenerating model.
    
    Command: Specify opposite corner:
    Command: e
    ERASE 1000 found
    
    Command: perf
    
    Current time:             Thursday, February 10, 2011  9:19:33:084 AM
    Times for this drawing:
      Created:                Thursday, February 10, 2011  9:17:36:746 AM
      Last updated:           Thursday, February 10, 2011  9:17:36:746 AM
      Total editing time:     0 days 00:01:56:362
      Elapsed timer (on):     0 days 00:00:02:291
      Next automatic save in: <disabled>
    Attached Files Attached Files

  5. #25
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: 2011 VERY slow lisp performance!

    Quote Originally Posted by serhanbakir298323 View Post
    ps: beware that your polylines are old type, they are not LWpolyline.
    Here is code for LWpolyline, but nevertheless times are slower then your code with (entmake) :

    Code:
    (defun c:perf()
      (setq osm (getvar 'osmode))
      (setq cmde (getvar 'cmdecho))
      (setvar 'osmode 0)
      (setvar 'cmdecho 0)
      (vl-cmdf "'time" "r" "")
      (setq i 0 p0 (list 0 0) p1 (list 0 1000))
      (vl-load-com)
      (setq msp (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object))))
      (repeat 1000
        (setq p0 (list (* i 150) 0) p1 (list (* i 150) 1000) )
        (setq ptl (list p0 p1) )
        (setq ptl (apply 'append ptl))
        (setq pts (vlax-make-variant
                  (vlax-safearray-fill
                  (vlax-make-safearray vlax-vbdouble (cons 0 (1- (length ptl))))
                  ptl
                  )
                  )
        )
        (setq plin (vla-addlightweightpolyline msp pts))
        (vlax-put-Property plin 'ConstantWidth 10)
        (vla-update plin)
        (vlax-release-object plin)
        (setq i (1+ i))
      )
      (setvar 'osmode osm)
      (setvar 'cmdecho cmde)
      (vl-cmdf "'time" "d" "")
    (princ)
    )
    M.R.
    p.s. I can't now use EDIT option when I am logged on (I didn't wanted to put this message in new post, but after one with my Visual Lisp code)
    Attached Files Attached Files
    Last edited by marko_ribar; 2011-02-11 at 09:59 AM. Reason: attaching my svf file...

  6. #26
    Active Member
    Join Date
    2005-12
    Posts
    72
    Login to Give a bone
    0

    Default Re: 2011 VERY slow lisp performance!

    Hi there,
    thanks to everyone who put effort on this topic. I have compared endless system variables finding out neither of them had any effect on this particular problem.

    Rather I have found out that it is another issue which is created by "BHATCH" and can be resolved by "OSNAP"

    below is the code to compare two states of the autocad 2011. if you execute the following function first it will create a rectangle, hatch its interior with bhatch and run the polyline creator "perf" subroutine. This first cycle will be slow, than it will erase all and turn osnap off and run "perf" again. The second result is faster in order of magnitude in my trials. 20 second vs 1 sec.
    Don't get it wrong, even if the osnap is off you experience slow performance! You need to enter (vl-cmdf "osnap" "off") no matter what.

    I still didn't understand why this is happening and want to submit a bug report or contact with developers for a reasonable solution rather than what I've found by myself. For this matter I'm asking for your help again to point me to the right people and the proper way to contact autodesk help.

    Code:
    (defun c:comp()
      (princ "\nFirst run in slow mode")(read-line)
      (vl-cmdf "rectangle" (list 0 0) (list 1000 1000))
      (vl-cmdf "zoom" "s" "0.001")
      (vl-cmdf "bhatch" "s" "l" "" "");	BHATCH is what makes the system slow down!
      (vl-cmdf "erase" "all" "")
      (perf)
      (princ "\nNow it will run faster")
      (graphscr)
      (read-line)
      (vl-cmdf "erase" "all" "")
      (vl-cmdf "osnap" "off" );		and OSNAP takes everything back to normal...
      (perf)
      (graphscr)
      (princ "\nLets compare the results")(read-line)(textscr)
      (princ)
      )
    
    (defun perf()
      (vl-cmdf "'time" "r" "")
      (setq i 0)
      (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)
      )
    Last edited by serhanbakir298323; 2011-02-11 at 12:39 PM.

  7. #27
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: 2011 VERY slow lisp performance!

    Now, when you discovered what was wrong, why don't you put these lines into your acad2011doc.lsp, so you can always have optimized CAD for LISP routines environment, and backup original acad2011doc.lsp, so you can always put it back... Add these two lines at the end of C:\Program Files\Autodesk\AutoCAD 2011\Support\acad2011doc.lsp :

    Code:
    (vl-cmdf "osnap" "off")
    (setvar 'cmdecho 0)
    M.R.

  8. #28
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,105
    Login to Give a bone
    0

    Default Re: 2011 VERY slow lisp performance!

    Quote Originally Posted by marko_ribar View Post
    Now, when you discovered what was wrong, why don't you put these lines into your acad2011doc.lsp, so you can always have optimized CAD for LISP routines environment, and backup original acad2011doc.lsp, so you can always put it back... Add these two lines at the end of C:\Program Files\Autodesk\AutoCAD 2011\Support\acad2011doc.lsp :

    Code:
    (vl-cmdf "osnap" "off")
    (setvar 'cmdecho 0)
    M.R.
    Why not simplify your setup and use the acaddoc.lsp file. This is a user / cad manager generated file and will not get modified from a installation repair or update. It is recommended to not modify the acad20XXdoc.lsp or acad20XX.lsp files, as those are supplied by Autodesk and may get modified by updates or repairs to AutoCAD.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  9. #29
    Active Member
    Join Date
    2005-12
    Posts
    72
    Login to Give a bone
    0

    Default Re: 2011 VERY slow lisp performance!

    Hello,

    I wonder if anybody tried out the comparison code that I submitted ("c:comp") and do you experience the same behavior like I do? The issue isn't where to put (vl-cmdf "osnap" "off"), the main questions are why bhatch causes this slow down and how osnap off command resolves it??? It doesn't make any sense really...

  10. #30
    Woo! Hoo! my 1st post
    Join Date
    2020-10
    Posts
    1
    Login to Give a bone
    1

    Default Re: 2011 VERY slow lisp performance!

    Quote Originally Posted by Serhan_BAKIR View Post
    Hello,

    I wonder if anybody tried out the comparison code that I submitted ("c:comp") and do you experience the same behavior like I do? The issue isn't where to put (vl-cmdf "osnap" "off"), the main questions are why bhatch causes this slow down and how osnap off command resolves it??? It doesn't make any sense really...
    I actually tried this today - in the year 2020, in both Autocad Architecture 2021, as well as in Autocad 2007.
    The results are stunning:

    The process (both the before and after) run:
    Elapsed timer (on): 0 days 00:02:41:000 Autocad Architecture 2021
    Elapsed timer (on): 0 days 00:00:04:182 Autocad 2007

    4 seconds in 2007 vs 2min 41 sec in 2021!

    I arrived here because I noticed that most of my lisp routines that do some sort of repeating (like I routine I have for drawing window pane divisions) run decidedly slower in 2021 than they do in 2007 (on the same machine).

    And to be clear, my ACA2021 isn't running sluggish in general. I have various tweaks like restricting when the ribbon appears that keep my drafting smoothly. It's just when I run lisp routines that the speed difference is noticeable.

Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Slow performance
    By julie.donovan in forum Revit MEP - General
    Replies: 6
    Last Post: 2010-06-29, 12:33 PM
  2. ACA 2010 Slow Performance
    By jraesly in forum ACA General
    Replies: 5
    Last Post: 2010-03-10, 09:02 PM
  3. Slow performance
    By tra1133 in forum ACA General
    Replies: 2
    Last Post: 2009-12-14, 11:07 PM
  4. Very slow performance aca2009
    By Wagurto in forum ACA General
    Replies: 3
    Last Post: 2008-08-18, 12:50 PM
  5. ADT 2006 - Slow Performance
    By doug.79572 in forum ACA General
    Replies: 1
    Last Post: 2007-01-06, 12:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •