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

src/runtime: switch to stronger hash function #2740

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from

Conversation

Copy link
Member

@dgryski dgryski commented Mar 29, 2022

Fixes #1553

@dgryski dgryski changed the title src/runtime: first darft of map growth code src/runtime: switch to stronger hash function Mar 29, 2022
@dgryski
Copy link
Member Author

@dgryski dgryski commented Mar 29, 2022

This still needs build tags to keep the older fnv hash function on smaller platforms.

@dgryski
Copy link
Member Author

@dgryski dgryski commented Mar 30, 2022

~/go/src/github.com/tinygo-org/tinygo/testdata $ tinygo build -target=wasi -size=full mapgrowth.go
   code  rodata    data     bss |   flash     ram | package
------------------------------- | --------------- | -------
   6063       0     309  130588 |    6372  130897 | (unknown)
   1122       0       0       4 |    1122       4 | internal/task
   1654       0       0       0 |    1654       0 | main
   8556       0      16     155 |    8572     171 | runtime
------------------------------- | --------------- | -------
  17395       0     325  130747 |   17720  131072 | total
~/go/src/github.com/tinygo-org/tinygo/testdata $ tinygo build -tags=runtime_memhash_tsip -target=wasi -size=full mapgrowth.go
   code  rodata    data     bss |   flash     ram | package
------------------------------- | --------------- | -------
   6314       0     309  130588 |    6623  130897 | (unknown)
      5       0       0       0 |       5       0 | encoding/binary
   1122       0       0       4 |    1122       4 | internal/task
   1654       0       0       0 |    1654       0 | main
     24       0       0       0 |      24       0 | math/bits
   9194       0      16     155 |    9210     171 | runtime
------------------------------- | --------------- | -------
  18313       0     325  130747 |   18638  131072 | total

@dgryski
Copy link
Member Author

@dgryski dgryski commented Mar 30, 2022

Hmm... seems like the speed crossover for tsip vs fnv (at least on amd64 and wasi) is at ~20-30 bytes. LevelDB seems to always be faster. And smaller than tsip.

@dgryski
Copy link
Member Author

@dgryski dgryski commented Mar 30, 2022

~/go/src/github.com/tinygo-org/tinygo/testdata $ tinygo build -tags=runtime_memhash_leveldb -target=wasi -size=full mapgrowth.go
   code  rodata    data     bss |   flash     ram | package
------------------------------- | --------------- | -------
   6064       0     309  130588 |    6373  130897 | (unknown)
   1122       0       0       4 |    1122       4 | internal/task
   1654       0       0       0 |    1654       0 | main
   8663       0      16     155 |    8679     171 | runtime
------------------------------- | --------------- | -------
  17503       0     325  130747 |   17828  131072 | total

@dgryski dgryski marked this pull request as ready for review Mar 31, 2022
@deadprogram
Copy link
Member

@deadprogram deadprogram commented Apr 4, 2022

@dgryski can you please rebase this PR now against dev? Thank you.

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

2 participants