-
Notifications
You must be signed in to change notification settings - Fork 48
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
Improve performance of encodeNestedLists #453
Conversation
This improves this example in the documentation, but I'm not sure how to rework that part: In[]:= AbsoluteTiming[WolframModel[{{{0}} -> {{0}, {0}, {0}}, {{0}, {0}, {0}} -> {{0}}}, {{0}}, <|"MaxEvents" -> 30|>, Method -> "LowLevel"]] // First
Out[]= 1.88309
In[]:= AbsoluteTiming[WolframModel[{{{0}} -> {{0}, {0}, {0}}, {{0}, {0}, {0}} -> {{0}}}, {{0}}, <|"MaxEvents" -> 30|>, Method -> "Symbolic"]] // First
Out[]= 0.019555 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example from the documentation is about a completely separate issue (#31). I don't think it really needs changing at all, but we can update the timing since it has probably improved due to this and @aokellermann's optimizations.
Reviewed 2 of 2 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @daneelsan)
Kernel/setSubstitutionSystem$cpp.m, line 80 at r1 (raw file):
(* This format is used to pass both rules and set data into libSetReplace over LibraryLink *) encodeNestedLists[l_List] := Flatten @ {Length @ l, encodeNestedLists /@ l}
Please use more descriptive variable names, e.g., l -> list
and a -> arg
.
Tests/performance.wlt, line 33 at r1 (raw file):
1000]], List, TimeConstraint -> 10,
This test actually has nothing to do with this (the initial state is small here). The reason the time constraint is so large here is that the test does not fail randomly due to fluctuations in performance and would only fail if it was catastrophically slower than before.
…anges in unit test in "performance".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @maxitg)
Kernel/setSubstitutionSystem$cpp.m, line 80 at r1 (raw file):
Previously, maxitg (Max Piskunov) wrote…
Please use more descriptive variable names, e.g.,
l -> list
anda -> arg
.
Done.
Tests/performance.wlt, line 33 at r1 (raw file):
Previously, maxitg (Max Piskunov) wrote…
This test actually has nothing to do with this (the initial state is small here). The reason the time constraint is so large here is that the test does not fail randomly due to fluctuations in performance and would only fail if it was catastrophically slower than before.
Reverted the changes I made there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! 🚀
Reviewed 2 of 2 files at r2.
Reviewable status:complete! all files reviewed, all discussions resolved
Changes
encodeNestedLists
insidesetSubstitutionSystem$cpp.m
by not usingReplaceRepeated
.Examples
This change is