-
-
Notifications
You must be signed in to change notification settings - Fork 205
Faster Partition[] #615
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
Faster Partition[] #615
Conversation
|
Looks like a good optimisation. I'm not entirely happy with the additional complexity introduced here (e.g. relying on sequences) though. |
|
I'm not really happy with this sequence part complexity either, but then the optimization really relies on not reevaluating all these leaves and using the reduced sequence information that's already there. For example, using I wonder if it can be encapsulated in a cleaner way. |
|
I've added the same method to Yields Concering the In the long term, though, I believe, we will end up with a data structure that is sort a hybrid of the sequence cache and #575, something like a dict of heads, where for each a list of occurence indices is stored. There's are a lot of iterations in Mathics that need not to go over all leaves, but only over those with specific heads (esp. in the pattern matcher). So EDIT In C a nice structure to accomplish the latter would be a sort of skip list:
|
|
continued in #619 |
Speeds up Partition[] by a factor 2 (using
First[Timing[Partition[Range[50000], 15, 1]]], goes from roughly 14s to 7s). If merged together with #575, it's a factor 8, as it then thelast_evaluatedoptimization really works).