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

We don't need to store index at each node. #80

Merged
merged 2 commits into from
Apr 10, 2023

Conversation

howsiyu
Copy link
Contributor

@howsiyu howsiyu commented Apr 7, 2023

No description provided.

Copy link
Member

@aloctavodia aloctavodia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! If there is not objection from @fjloyola I will merge.

@fjloyola
Copy link
Contributor

LGTM! If there is not objection from @fjloyola I will merge.

It's ok for me, as it is simpler I feel that is a good change and will improve the memory uses ( taking away redundant data),

about this change,

@lru_cache
def get_depth(index: int) -> int:
    return math.floor(math.log2(index + 1))
    return (index + 1).bit_length() - 1

probably with this type of operation we don't need to cache the response because is not that expensive .bit_lenght() we should check performance later without the decorator

@aloctavodia
Copy link
Member

LGTM! If there is not objection from @fjloyola I will merge.

It's ok for me, as it is simpler I feel that is a good change and will improve the memory uses ( taking away redundant data),

about this change,

@lru_cache
def get_depth(index: int) -> int:
    return math.floor(math.log2(index + 1))
    return (index + 1).bit_length() - 1

probably with this type of operation we don't need to cache the response because is not that expensive .bit_lenght() we should check performance later without the decorator

Thanks for checking! I think we can leave this as is for the moment. And then discuss removing the cache. Also, we can even compute precompute this only once, because we know the maximum depth (it is just a function of a hyper-paramenter).

@aloctavodia aloctavodia merged commit b4043ba into pymc-devs:main Apr 10, 2023
3 checks passed
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

Successfully merging this pull request may close these issues.

None yet

3 participants