-
Notifications
You must be signed in to change notification settings - Fork 22
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
Optimize __lookup function #24
Milestone
Comments
Here are some performance numbers for this change relative to other recent optimizations. PerformanceMacBook Pro (2019) | 2.4 GHz 8-core i9, 32 GB RAM, macOS 10.15
iPhone 8 | A11, iOS 13
iPad Air (2013) | A7, iOS 12
Size
Legend
|
Merged to |
This was referenced Sep 14, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
__lookup
function is called thousands of times (167548 times, to be exact) when running the En-ROADS model, so some simple optimizations will help improve performance.I was able to get some decent wins just by reducing the number of instructions in the inner loop. Using binary search could potentially help a bit, but my initial experiment with that didn't provide much improvement over a straight linear search. About half of the lookup tables in En-ROADS are 100-200 elements, while the other half have only 10-50 elements, so linear search is probably sufficient.
The text was updated successfully, but these errors were encountered: