Skip to content
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

performance: Appends to region_highlight are quadratic? #388

Open
2 tasks
danielshahaf opened this issue Nov 8, 2016 · 2 comments
Open
2 tasks

performance: Appends to region_highlight are quadratic? #388

danielshahaf opened this issue Nov 8, 2016 · 2 comments

Comments

@danielshahaf
Copy link
Member

@psprint reports that appending to $region_highlight is faster if first accumulating to another array and then appending to $region_highlight in one shot, compared to appending to $region_highlight directly.

Speculation: this may be because the $region_highlight is a special array (in the ${(t)foo} sense), and because the array's setfn is called on the entire array each time, not only on the appended portion.

  • Investigate the difference quantitatively
  • If needed, switch from appending directly to using a temporary array
@danielshahaf
Copy link
Member Author

workers/39869 might be related.

@danielshahaf
Copy link
Member Author

If needed, switch from appending directly to using a temporary array

Note that array appends are quadratic too, independently of region_highlight's setter. Possibly with a smaller big-O constant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant