-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help needed: 3 different performance timings with same code #9
Comments
I think the slowness in the first case can be explained by noting the time at which the effects of the The (eval-when (:compile-toplevel :load-toplevel :execute)
(print "should be at compile-time")
(unless (sb-c::info :function :info ',name)
(sb-c:defknown ,name * * nil :overwrite-fndb-silently t))) Compiling and loading @mfiano 's example via
That is, the effect happens at load-time, not compile-time. |
To avoid these difference you should define the generic functions and their methods in a separate file from the code which uses them. As already mentioned by @scymtym, what's happening here is that since they are contained in the same file, the I don't know what's causing the difference between the second and third case. There shouldn't be any difference unless SBCL is performing more optimizations when the |
I am experiencing 3 different performance results consistently with the same code, depending on how I load it. Here is the test code:
Clearing FASL's, loading this code into my image on SBCL 2.1.7, and issuing:
I get these results consistently:
If I now re-compile the
#'test
function in the same image, and re-run the test I consistently get:If I wrap the
defgeneric
in(eval-when (:compile-toplevel :load-toplevel :execute) ...)
, clear FASL's, loading the code, and re-run the test, I consistently get:I get no warnings from static-dispatch in all 3 cases, and everything compiles cleanly. I would like to know why these differences are occurring, and how I would get the results of the second test above from a clean image (instead of manually recompiling the function after loading). Thank you for your help.
The text was updated successfully, but these errors were encountered: