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

Idea: improve memory behavior of tracking changed vars during propagation #94

Open
pvdz opened this issue Jun 29, 2016 · 0 comments
Open

Comments

@pvdz
Copy link
Contributor

pvdz commented Jun 29, 2016

Currently the propagation tracks all the changed variables and when it completes a propagation cycle, it will queue up all the propagators that are affected by the vars changed in the previous cycle. It repeats until no more variables change.

While this is super efficient on the one hand it does mean having highly volatile objects during a search. Temporary queue objects are created and destroyed by the millions which is very heavy on on the GC. We probably want to take a look at some standard techniques in an attempt to mitigate that. Recycle a queue, or use two and swap them after every cycle, etc.

  • temporary objects should be very cheap these days thanks to JIT (but don't appear to and is engine dependent)
  • the array only contains numbers (indexes) so we could use one of [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays](the fixed size arrays) like Uint16Array. Together with a fixed length, the upper bound being the total number of variables, this could prevent a lot of GC related overhead
  • it may not matter at all, the slowness could be originating from a different artifact.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant