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

【发起分享提案】分析 Eisel-Lemire 算法 #719

Open
yangwenmai opened this issue Feb 22, 2021 · 0 comments
Open

【发起分享提案】分析 Eisel-Lemire 算法 #719

yangwenmai opened this issue Feb 22, 2021 · 0 comments
Assignees
Labels
Go 夜读 Go 夜读:主题分享

Comments

@yangwenmai
Copy link
Member

为什么 Go 1.16 ParseFloat 可以获得性能提升

分析 Eisel-Lemire 算法,了解其根本原因。

Passing "go test -test.count=5 -test.run=xxx -test.bench=Atof64" on to
benchstat:

name                  old time/op  new time/op  delta
Atof64Decimal-4       47.9ns ± 0%  48.3ns ± 1%     ~     (p=0.238 n=4+5)
Atof64Float-4         58.3ns ± 3%  57.7ns ± 0%     ~     (p=0.151 n=5+5)
Atof64FloatExp-4       107ns ± 0%    71ns ± 1%  -33.89%  (p=0.016 n=4+5)
Atof64Big-4            163ns ± 0%   166ns ± 2%     ~     (p=0.159 n=4+5)
Atof64RandomBits-4     299ns ± 1%   166ns ± 1%  -44.41%  (p=0.008 n=5+5)
Atof64RandomFloats-4   188ns ± 1%   144ns ± 0%  -23.03%  (p=0.008 n=5+5)
This does for ParseFloat(etc, 32) what commit a2eb53c571 did for
ParseFloat(etc, 64).

name              old time/op  new time/op  delta
Atof32Decimal-4   48.3ns ± 4%  48.8ns ± 2%     ~     (p=0.548 n=5+5)
Atof32Float-4     56.2ns ± 5%  54.7ns ± 3%     ~     (p=0.246 n=5+5)
Atof32FloatExp-4   104ns ± 0%    76ns ± 2%  -27.19%  (p=0.008 n=5+5)
Atof32Random-4     142ns ± 2%   109ns ± 1%  -23.07%  (p=0.008 n=5+5)

诉求

学习 Go 官方包中采用特定 Eisel-Lemire 算法优化性能。

参考资料

https://go-review.googlesource.com/c/go/+/260858
https://go-review.googlesource.com/c/go/+/264517
https://nigeltao.github.io/blog/2020/eisel-lemire.html


备注

任何你想要表达的话语。

@yangwenmai yangwenmai added the Go 夜读 Go 夜读:主题分享 label Feb 22, 2021
@changkun changkun removed their assignment Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Go 夜读 Go 夜读:主题分享
Projects
None yet
Development

No branches or pull requests

2 participants