Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2682d2ab17a40851f7e6bcff35126e810b0646fd
https://github.com/WebKit/WebKit/commit/2682d2ab17a40851f7e6bcff35126e810b0646fd
Author: Keita Nonaka <[email protected]>
Date: 2025-05-21 (Wed, 21 May 2025)
Changed paths:
A JSTests/microbenchmarks/math-sumPrecise-10.js
A JSTests/microbenchmarks/math-sumPrecise-100.js
A JSTests/microbenchmarks/math-sumPrecise-1000.js
A JSTests/microbenchmarks/math-sumPrecise-10000.js
M Source/WTF/wtf/PreciseSum.cpp
M Source/WTF/wtf/PreciseSum.h
Log Message:
-----------
[JSC] Switch from Shewchuk’s Algorithm to xsum Algorithm to Optimize
`Math.sumPrecise`
https://bugs.webkit.org/show_bug.cgi?id=293158
Reviewed by Yusuke Suzuki.
Previously, Shewchuk's algorithm was used [1], but it became slow with large
arrays.
Improving the performance of Math.sumPrecise is important because it may be
used in
scientific calculations, charting, and statistical analysis of large data sets,
where both high precision and fast speed are essential.
This patch switches to Radford M. Neal's xsum algorithm [2],
which improves the performance of Math.sumPrecise.
The original implementation is in C [3]; a C++ translation was referenced for
integration [4].
TipOfTree Patched
Ratio
math-sumPrecise-10 3.4638+-0.0681 2.6122+-0.0922
1.2338x faster
math-sumPrecise-100 27.2897+-0.115 17.9712+-0.0483
1.5185x faster
math-sumPrecise-1000 283.2722+-4.3743 171.4865+-2.4889
1.6518x faster
math-sumPrecise-10000 2922.8715+-9.1500 1709.5876+-4.2845
1.7096x faster
[1]:
https://github.com/WebKit/WebKit/commit/f49d6a41fb8d93f9c7e6758d87a06a9eea3e9698
[2]: https://arxiv.org/abs/1505.05571
[3]: https://gitlab.com/radfordneal/xsum
[4]: https://github.com/Gumichocopengin8/xsum.cpp
* JSTests/microbenchmarks/math-sumPrecise-10.js: Added.
* JSTests/microbenchmarks/math-sumPrecise-100.js: Added.
* JSTests/microbenchmarks/math-sumPrecise-1000.js: Added.
* JSTests/microbenchmarks/math-sumPrecise-10000.js: Added.
* Source/WTF/wtf/PreciseSum.cpp:
(WTF::XsumSmallAccumulator::XsumSmallAccumulator):
(WTF::PreciseSum::PreciseSum):
(WTF::PreciseSum::addList):
(WTF::PreciseSum::add):
(WTF::PreciseSum::compute):
(WTF::PreciseSum::xsumSmallAddInfNan):
(WTF::PreciseSum::xsumAdd1NoCarry):
(WTF::PreciseSum::xsumCarryPropagate):
(WTF::PreciseSum::incrementWhenValueAdded):
(WTF::twosum): Deleted.
* Source/WTF/wtf/PreciseSum.h:
Canonical link: https://commits.webkit.org/295242@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes