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: LRUCache - similar to StrictMap #112

Open
TysonAndre opened this issue Feb 7, 2022 · 1 comment
Open

Idea: LRUCache - similar to StrictMap #112

TysonAndre opened this issue Feb 7, 2022 · 1 comment

Comments

@TysonAndre
Copy link
Owner

  • new LRUCache(?int $maxSize = null)
  • Make unshift() operations faster, track the offset of the start of the buckets for LRUCache, to speed up iteration and removal
  • Add $cache->getOrCreate(mixed $key, callable $create)
  • Benchmark difference from polyfills, e.g. for strings, objects, etc.
@TysonAndre
Copy link
Owner Author

Adding getOrCreate($key, callable $callback) to Map seems easier.

Tracking start HashPosition would avoid this worst-case performance in maps in general (update on iteration)

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