Skip to content

Faster ReadString by avoiding memory allocations in []byte to string conversion #678

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

Closed

Conversation

saurabhagrawal-86
Copy link

Benchstat results:

name                    old time/op    new time/op    delta
_jsoniter_large_file      10.8µs ± 6%     8.9µs ± 7%  -17.69%  (p=0.000 n=10+10)
_jsoniter_large_file-2    10.6µs ±10%     9.2µs ± 5%  -13.07%  (p=0.000 n=10+10)
_jsoniter_large_file-4    10.9µs ±10%     9.2µs ± 9%  -14.91%  (p=0.000 n=10+10)

name                    old alloc/op   new alloc/op   delta
_jsoniter_large_file      4.91kB ± 0%    4.37kB ± 0%  -11.07%  (p=0.000 n=10+10)
_jsoniter_large_file-2    4.91kB ± 0%    4.37kB ± 0%  -11.07%  (p=0.000 n=10+10)
_jsoniter_large_file-4    4.91kB ± 0%    4.37kB ± 0%  -11.07%  (p=0.000 n=10+10)

name                    old allocs/op  new allocs/op  delta
_jsoniter_large_file        78.0 ± 0%       5.0 ± 0%  -93.59%  (p=0.000 n=10+10)
_jsoniter_large_file-2      78.0 ± 0%       5.0 ± 0%  -93.59%  (p=0.000 n=10+10)
_jsoniter_large_file-4      78.0 ± 0%       5.0 ± 0%  -93.59%  (p=0.000 n=10+10)
@saurabhagrawal-86
Copy link
Author

Unsafe is not really safe here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant