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

use long for internal counters #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

use long for internal counters #12

wants to merge 1 commit into from

Conversation

rr0gi
Copy link

@rr0gi rr0gi commented Feb 9, 2022

I have a hashmap of 250M+ elements, buckets_num overflows on resize (and thankfully asserts, unlike builtin aa which seems to just corrupt memory)
Idk if making it compile-time parameters is better option, or maybe using size_t
also I am not sure if changing visible type of cache2q.length is acceptable, hence the cast

@ikod
Copy link
Owner

ikod commented Feb 9, 2022

Thanks, @rr0gi

will check today

@@ -162,7 +162,7 @@ class Cache2Q(K, V, Allocator=Mallocator)
///
final int length() @safe
{
return _InMap.length + _OutMap.length + _MainMap.length;
return cast(int)(_InMap.length + _OutMap.length + _MainMap.length);
Copy link
Owner

Choose a reason for hiding this comment

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

I'm not sure if this is good to convert long to int here. Should length() return long in this case?

Copy link
Author

Choose a reason for hiding this comment

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

also I am not sure if changing visible type of cache2q.length is acceptable, hence the cast

I would return long (or even better change everything to ulong) :)

Copy link
Owner

Choose a reason for hiding this comment

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

This would require API change. this is ok, just have to change major version

@rr0gi
Copy link
Author

rr0gi commented Feb 14, 2022

rebased to master and removed cast

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.

2 participants