segmentio / fasthash

Go package porting the standard hashing algorithms to a more efficient implementation.
MIT License
283 stars 21 forks source link

jody: fix checkptr segfault #14

Open yerden opened 1 year ago

yerden commented 1 year ago

Fix checkptr segfault by disallowing advancing pointer beyond the Go allocation.

Signed-off-by: Yerden Zhumabekov yerden.zhumabekov@gmail.com

yerden commented 1 year ago
$ benchstat old.txt new.txt
name                                 old time/op    new time/op    delta
Hash64/jody/optimized/strlen=4-4       5.59ns ± 1%    5.68ns ± 4%   +1.63%  (p=0.043 n=9+10)
Hash64/jody/optimized/strlen=11-4      7.71ns ± 3%    6.91ns ± 1%  -10.45%  (p=0.000 n=10+10)
Hash64/jody/optimized/strlen=36-4      10.6ns ± 1%    10.5ns ± 1%   -1.07%  (p=0.001 n=10+9)
Hash64/jody/optimized/strlen=1000-4     283ns ± 0%     281ns ± 0%   -0.71%  (p=0.000 n=10+10)

name                                 old speed      new speed      delta
Hash64/jody/optimized/strlen=4-4      716MB/s ± 1%   704MB/s ± 3%   -1.57%  (p=0.043 n=9+10)
Hash64/jody/optimized/strlen=11-4    1.43GB/s ± 3%  1.59GB/s ± 1%  +11.66%  (p=0.000 n=10+10)
Hash64/jody/optimized/strlen=36-4    3.39GB/s ± 1%  3.43GB/s ± 1%   +1.09%  (p=0.002 n=10+9)
Hash64/jody/optimized/strlen=1000-4  3.53GB/s ± 0%  3.55GB/s ± 0%   +0.72%  (p=0.000 n=10+10)