-
Notifications
You must be signed in to change notification settings - Fork 62
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
Evaluating rules is unreasonably slow on first call #5
Comments
What happens if we do a top level Answer: helps a bit but not much |
Is there still a large overhead between first and second call? Or are they about the same? |
It was below the noise level for both. |
You're probably just getting interpreter run time then |
This feels a lot better when I was trying it after the breakup into two packages, |
#35 does indeed fix this. Test Script
Timing ResultsCurrent Masterrrule: 0.043273 seconds (29.90 k allocations: 1.602 MiB, 14.56% gc time) No cassette branch #35rrule: 0.040967 seconds (29.90 k allocations: 1.602 MiB) |
😆 |
I have a Manifest.toml there |
Currently, evaluating rules can be pretty slow (and in some cases extremely slow) on the first call. It seems to be due to JIT compiling the anonymous functions, the use of which is a central design point of ChainRules.
Here's a basic example, where it takes 2.6 seconds(!!!) to evaluate the derivative for
svd
. Note that the ChainRules version is a simple port of the Nabla version, so the underlying code that does the computation is nearly identical.Compare this to Nabla:
We should find some way(s) to mitigate this so that AD systems which switch to using ChainRules underneath won't take an enormous performance hit by doing so.
The text was updated successfully, but these errors were encountered: