-
Notifications
You must be signed in to change notification settings - Fork 48
perf: Use flyweight for node fields #1654
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
Conversation
bigframes/core/chain_list.py
Outdated
@@ -0,0 +1,53 @@ | |||
# Copyright 2024 Google LLC |
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.
nit: 2025
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.
done
bigframes/core/chain_list.py
Outdated
# * Support insertions and deletions | ||
|
||
|
||
class ChainList(collections.abc.Sequence[T]): |
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.
We should add some more doc to describe what this classes does. It's not obvious that the goal is to quickly locate an element from a concatenated sequence.
Plus, perhaps "ChainedSequence" is a better name?
In addition, this implementation might hurt performance if the provided "parts" are all very short. In that case, we are effectively using iterations in getitem(). Does it make sense to have certain kind of threshold? That is, if the total number of element is below certain threshold (10 maybe?), just concat everything into a tuple. Otherwise, use the current technique.
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.
added docstring and renamed
Added some conservative compaction logic as well. Key here is memory efficiency/reuse rather than lookup efficiency, so don't want to go to wild on those types of optimizations.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕