Giter VIP home page Giter VIP logo

Comments (3)

Amanieu avatar Amanieu commented on July 27, 2024 1

We can't use Allocator::grow because growing the table requires re-hashing all elements and moving them into new slots. We need the destination table to be empty when we do this.

I don't think there is anything actionable that we can do here. Fundamentally, if you have a short-lived hash table then you should pre-allocate it using with_capacity to avoid unnecessary allocations while the table is being filled in.

from hashbrown.

yanchith avatar yanchith commented on July 27, 2024

Here's the benchmark results on the M1

test tests::insert_hashmap_0128        ... bench:       3,464 ns/iter (+/- 33)
test tests::insert_hashmap_0256        ... bench:       6,976 ns/iter (+/- 169)
test tests::insert_hashmap_0512        ... bench:      14,142 ns/iter (+/- 363)
test tests::insert_hashmap_1024        ... bench:      28,418 ns/iter (+/- 776)
test tests::insert_hashmap_2048        ... bench:      56,802 ns/iter (+/- 1,536)
test tests::insert_hashmap_4096        ... bench:     115,039 ns/iter (+/- 1,993)
test tests::insert_hashmap_8192        ... bench:     230,840 ns/iter (+/- 2,915)
test tests::insert_hashmap_arena_0128  ... bench:       3,334 ns/iter (+/- 51)
test tests::insert_hashmap_arena_0256  ... bench:       6,745 ns/iter (+/- 88)
test tests::insert_hashmap_arena_0512  ... bench:      13,930 ns/iter (+/- 352)
test tests::insert_hashmap_arena_1024  ... bench:      28,146 ns/iter (+/- 748)
test tests::insert_hashmap_arena_2048  ... bench:      56,707 ns/iter (+/- 1,419)
test tests::insert_hashmap_arena_4096  ... bench:     114,617 ns/iter (+/- 1,487)
test tests::insert_hashmap_arena_8192  ... bench:     230,836 ns/iter (+/- 2,066)
test tests::insert_hashtrie_0128       ... bench:       3,960 ns/iter (+/- 72)
test tests::insert_hashtrie_0256       ... bench:       8,371 ns/iter (+/- 74)
test tests::insert_hashtrie_0512       ... bench:      19,459 ns/iter (+/- 983)
test tests::insert_hashtrie_1024       ... bench:      38,765 ns/iter (+/- 1,812)
test tests::insert_hashtrie_2048       ... bench:      80,342 ns/iter (+/- 3,970)
test tests::insert_hashtrie_4096       ... bench:     170,788 ns/iter (+/- 13,437)
test tests::insert_hashtrie_8192       ... bench:     359,124 ns/iter (+/- 27,457)
test tests::insert_hashtrie_arena_0128 ... bench:         906 ns/iter (+/- 120)
test tests::insert_hashtrie_arena_0256 ... bench:       2,208 ns/iter (+/- 69)
test tests::insert_hashtrie_arena_0512 ... bench:       4,829 ns/iter (+/- 58)
test tests::insert_hashtrie_arena_1024 ... bench:      11,538 ns/iter (+/- 186)
test tests::insert_hashtrie_arena_2048 ... bench:      27,082 ns/iter (+/- 581)
test tests::insert_hashtrie_arena_4096 ... bench:      59,013 ns/iter (+/- 1,308)
test tests::insert_hashtrie_arena_8192 ... bench:     132,295 ns/iter (+/- 11,462)

from hashbrown.

yanchith avatar yanchith commented on July 27, 2024

Makes sense. Thanks for clarifying!

Feel free to close this, if you feel like there's nothing that can be done.

from hashbrown.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.