Suha Posted January 4, 2021 Posted January 4, 2021 Call Grind for Lisp (CG) is a Lisp application aimed to help profiling of lisp programs running on IntelliCAD, AutoCAD, BricsCAD and alikes. If you are in need of determining the bottle-necks, the time consumed for specified functions , visualize call diagram of your lisp application you may find CG useful. CG collects data (time consumed by each function and call stack) at runtime (dynamic analysis) and creates “call grind” type output to be used by CacheGrind system (credit goes to authors). Requirement: Download and install qcachegrind software recompiled for Windows version of KCacheGrind. Refer to header of the lisp code attached for instructions. Limitation: May fail in consecutive functions forming loop. License: Copy Left Enhanced the code, found a bug? Just let me know. Suha cg.lsp 2 1 Quote
BIGAL Posted January 5, 2021 Posted January 5, 2021 Once you know "the time consumed for specified functions" what then ? Its well known that entmake is faster than command if doing in the hundreds. Making a table turn off the table regen turn back on when finished 1 line of code = 14 minutes of time save creating a 200+ line table with some complicated calcs. I write very simple lisp compared to others and at times is slow, time saving is in knowing about something in the coding method rather than this function causes a 5 minute delay. I dont write a couple of hundred lines of code with out testing like 20 at a time or seperate defuns, so soon find a bottle neck and stop and have a think about is there a faster way. Having a number of speed up hints would probably be more beneficial, there are numerous posts here were methods have been compared on like a 1000 repetitions to get the best optimised code. What is slow ? Something I just did say 15 minutes to draft. With dcl user input its now like 20 seconds. Is this not fast enough ? The only time, excuse pun is when manipulating large data sets that the Cad can seriously slow down. Its up to the programmer then to look at how to fix. Quote
Semx11 Posted October 5, 2022 Posted October 5, 2022 Thank you so much for this program, it has allowed us to profile a large AutoLISP application and find out where the bottlenecks were. A small fix I made (at least on Windows) was on line 271: (setq fname (strcat fname "\\callgrind.out.lisp")) I had to add the \\ because "MYDOCUMENTSPREFIX" (in my case: "C:\\Users\\<user>\\Documents") does not end with them, so it would save the file as "Documentscallgrind.out.lisp". I also added/fixed the provided Regex to support VSCode out of the box, as this is the main environment we program in because of the official AutoLISP extension: Find (VSCode): ^\(defun\s+(\S+)\s*(\(([\w\s\n\-\+%&#$@]*).*) Replace (VSCode): (defun $1 ($3 / retval)\n\t(cg_begin "$1")\n\t(setq retval ($1_cg$ $3))\n\t(cg_end)\n\tretval\n)\n(defun $1_cg$ $2 Maybe this is useful for other people too. Thank you again for this wonderful program Quote
Suha Posted October 10, 2022 Author Posted October 10, 2022 I am glad CG helped you. Also thanks for the contribitions. Suha Quote
fakije9009 Posted November 19, 2022 Posted November 19, 2022 It is commonly known that entmake executes commands in the hundreds of times faster than command. Making a table turn off the table regen turn back on when finished saves 14 minutes compared to making a 200+ line table with a few tricky calculations. It would store the file as "Documentscallgrind.out.lisp," thus I had to append the since "MYDOCUMENTSPREFIX" (in my example, "C: Usersuser>Documents") does not end with them. Compared to other people, I write extremely simple lisp, which can occasionally be slow. Time can be saved by understanding a coding technique rather than by using a function that delays execution by 5 minutes. I don't create many hundred lines of code without testing them like 20 at a time or using separate defuns, so I quickly run into a bottleneck and have to pause and consider whether there is a quicker method. Quote
fakije9009 Posted November 20, 2022 Posted November 20, 2022 The fact that entmake processes instructions numerous times faster than command is well known. As opposed to creating a 200plus line table with a few challenging computations, creating a table that turns off the table regenerate and turns back on when finished saves minutes. Due to the click that "MYDOCUMENTSPREFIX" (in my case, "C: Usersuser>Documents") does not end with them, the file would be stored as "Documentscallgrind.out.lisp," therefore I had to append it. I write very simple lisp, which is sometimes slow, compared to other people. Learning a coding trick can save time instead of employing a function whose execution is delayed by five minutes. I rarely write more than a few hundred lines of code without testing them Twenty at a time or using separate defuns, so I rapidly hit a roadblock and must halt to think of a faster way. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.