Skip to content

use long for internal counters#12

Open
rr0gi wants to merge 1 commit intoikod:masterfrom
ahrefs:long
Open

use long for internal counters#12
rr0gi wants to merge 1 commit intoikod:masterfrom
ahrefs:long

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

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

Comments