Author Topic: AutoLisp collapse of Speed?  (Read 2001 times)

0 Members and 1 Guest are viewing this topic.

vlisp

  • Mosquito
  • Posts: 5
AutoLisp collapse of Speed?
« on: September 30, 2020, 07:13:22 AM »
I am working on a task that requires significant computational resources. The first 5 iterations AutoLisp works significantly fast, then slows down significantly. No objects are drawn in AutoCAD while the calculations are being made. Net calculations - rotation and translation of points. Any ideas what this could be?

Thanks!
 
« Last Edit: September 30, 2020, 07:34:22 AM by vlisp »

jtoverka

  • Newt
  • Posts: 127
Re: AutoLisp collapse of Speed?
« Reply #1 on: September 30, 2020, 07:50:49 AM »
The best I can offer you is to look at the computational complexity of your algorithm also known as the Big O.

https://en.wikipedia.org/wiki/Big_O_notation#/media/File:Comparison_computational_complexity.svg

Otherwise, we can't offer any other advice without seeing the code.

vlisp

  • Mosquito
  • Posts: 5
Re: AutoLisp collapse of Speed?
« Reply #2 on: September 30, 2020, 08:34:33 AM »
The complexity of the algorithm is not great, because the first iterations calculate them very quickly. Then at one node (vertex) of polygon makes 15 rotations for about 20 minutes! The the rotation polygon there is 5 vertices. 

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: AutoLisp collapse of Speed?
« Reply #3 on: September 30, 2020, 02:31:22 PM »
To reiterate one of the above points: without code, or even a program flow/outline, we're just taking wild stabs in the dark.  My jab: you're performing unnecessary repetitive calculations rather than organizing flow for an early exit.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: AutoLisp collapse of Speed?
« Reply #4 on: September 30, 2020, 04:38:58 PM »
Are you perhaps building lists within the loop which should be cleared with every iteration, but instead grow exponentially?

vlisp

  • Mosquito
  • Posts: 5
Re: AutoLisp collapse of Speed?
« Reply #5 on: September 30, 2020, 08:00:21 PM »


Hi Lee.
No. I use while every time and the lists decrease with each iteration. I've already done that. It's not about that. The list of points of polygon are constant and each iteration I am cutting one point.
« Last Edit: September 30, 2020, 08:11:23 PM by vlisp »

jtoverka

  • Newt
  • Posts: 127
Re: AutoLisp collapse of Speed?
« Reply #6 on: September 30, 2020, 08:04:58 PM »
To reiterate one of the above points: without code, or even a program flow/outline, we're just taking wild stabs in the dark.  My jab: you're performing unnecessary repetitive calculations rather than organizing flow for an early exit.

Hi Lee.
No. I use while every time and the lists decrease with each iteration. I've already done that. It's not about that.

We solve code problems, not riddles  :-P

BIGAL

  • Swamp Rat
  • Posts: 1409
  • 40 + years of using Autocad
Re: AutoLisp collapse of Speed?
« Reply #7 on: September 30, 2020, 08:07:53 PM »
Need lots more info like what are you actually doing the task ? Understand needs iteration but there are ways of speeding that up sometimes.
A man who never made a mistake never made anything

vlisp

  • Mosquito
  • Posts: 5
Re: AutoLisp collapse of Speed?
« Reply #8 on: September 30, 2020, 08:09:35 PM »
To reiterate one of the above points: without code, or even a program flow/outline, we're just taking wild stabs in the dark.  My jab: you're performing unnecessary repetitive calculations rather than organizing flow for an early exit.


The code is very long. If the lean part of the code will not be able to get an idea of ​​the problem. Yes there really are repetitive polygons as a result of the calculations. But this is the more economical option than comparing the newly obtained polygon with the already received polygons.

We solve code problems, not riddles  :-P

ronjonp

  • Needs a day job
  • Posts: 7527
Re: AutoLisp collapse of Speed?
« Reply #9 on: September 30, 2020, 10:42:00 PM »
Why don't you post your code? You will most likely get more help on this ... and as a bonus by some of the smartest minds out there.  :wink:

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC