RESOLVED FIXED Bug 123255
Add result caching for Math.cos
https://bugs.webkit.org/show_bug.cgi?id=123255
Summary Add result caching for Math.cos
Iago Toral
Reported 2013-10-24 01:03:55 PDT
Currently JavaScriptCore caches results for Math.sin, as introduced by the patch for bug #38714. I think it makes sense to do the same for Math.cos, since the same rationale used for Math.sin applies to Math.cos and also because these two functions are typically used together, for example to compute rotation transformations. I'll upload a patch shortly.
Attachments
Adds result caching for Math.cos (1.63 KB, patch)
2013-10-24 01:13 PDT, Iago Toral
no flags
Iago Toral
Comment 1 2013-10-24 01:13:52 PDT
Created attachment 215035 [details] Adds result caching for Math.cos A quick test consisting of averaging 5 consecutive runs of Sunspider shows a 1.9% benefit in my case.
Brent Fulgham
Comment 2 2013-10-30 10:06:05 PDT
Comment on attachment 215035 [details] Adds result caching for Math.cos r=me
WebKit Commit Bot
Comment 3 2013-10-30 10:45:49 PDT
Comment on attachment 215035 [details] Adds result caching for Math.cos Clearing flags on attachment: 215035 Committed r158281: <http://trac.webkit.org/changeset/158281>
WebKit Commit Bot
Comment 4 2013-10-30 10:45:51 PDT
All reviewed patches have been landed. Closing bug.
Filip Pizlo
Comment 5 2013-10-30 16:44:44 PDT
Was this based on any benchmarking? If so, why aren't the benchmarks part of the patch?
Iago Toral
Comment 6 2013-10-31 00:04:59 PDT
(In reply to comment #5) > Was this based on any benchmarking? If so, why aren't the benchmarks part of the patch? I ran the sunspider benchmark to assess performance improvement, my tests showed a 1.9% performance improvement on this benchmark as I mention in comment #1. I did not know there was a policy to include the benchmark results in the ChangeLog as part of the patch, so that was my bad :(
Filip Pizlo
Comment 7 2013-10-31 09:22:24 PDT
(In reply to comment #1) > Created an attachment (id=215035) [details] > Adds result caching for Math.cos > > A quick test consisting of averaging 5 consecutive runs of Sunspider shows a 1.9% benefit in my case. It's customary to post full performance results to bugzilla for optimizations like these. It's customary to run more than just SunSpider. It's unwise to rely on a single benchmark for optimizations. For example, Octane, JSBench, and Kraken are also important benchmarks.
Filip Pizlo
Comment 8 2013-10-31 09:23:40 PDT
Filip Pizlo
Comment 9 2013-10-31 11:49:34 PDT
(In reply to comment #7) > (In reply to comment #1) > > Created an attachment (id=215035) [details] [details] > > Adds result caching for Math.cos > > > > A quick test consisting of averaging 5 consecutive runs of Sunspider shows a 1.9% benefit in my case. > > It's customary to post full performance results to bugzilla for optimizations like these. > > It's customary to run more than just SunSpider. It's unwise to rely on a single benchmark for optimizations. For example, Octane, JSBench, and Kraken are also important benchmarks. Also, I cannot reproduce the speed-up that you're reporting. I'm seeing a 0.35% difference before and after your patch and that difference is in the noise.
Note You need to log in before you can comment on or make changes to this bug.