Bug 43257 - SunSpider's Math.random makes it unpredictable
Summary: SunSpider's Math.random makes it unpredictable
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 43253
  Show dependency treegraph
 
Reported: 2010-07-30 09:37 PDT by Paul Biggar
Modified: 2011-06-02 08:07 PDT (History)
4 users (show)

See Also:


Attachments
Makes math.random deterministic (1.61 KB, patch)
2010-08-06 13:56 PDT, Paul Biggar
no flags Details | Formatted Diff | Diff
Make math.random deterministic (sans upvars) (1.65 KB, patch)
2010-08-07 04:20 PDT, Paul Biggar
eric: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Biggar 2010-07-30 09:37:25 PDT
Sunspider calls Math.random in quite a few places, accounting for a measurable increase in run-time variance (https://bugzilla.mozilla.org/show_bug.cgi?id=580532#c24):

sunspider-0.9.1/string-validate-input.js
sunspider-0.9/string-base64.js
sunspider-0.9/string-validate-input.js
v8-v4/v8-crypto.js
v8-v4/v8-earley-boyer.js
v8-v4/v8-splay.js


In v8's test harness, Math.random is replaced by a deterministic function. However, Sunspider skips the v8 test harness.
Comment 1 Paul Biggar 2010-08-06 13:56:55 PDT
Created attachment 63758 [details]
Makes math.random deterministic

This replaces Math.random with v8's deterministic version.

You'll need patch -p4 to apply this.
Comment 2 Paul Biggar 2010-08-07 04:20:12 PDT
Created attachment 63814 [details]
Make math.random deterministic (sans upvars)

The upvars on the old patch change the characteristics of the test. This uses a plain old global variable instead.
Comment 3 Paul Biggar 2010-08-13 03:08:25 PDT
Ping? This is the simplest change to approve of all the blockers to bug 43253.
Comment 4 Eric Seidel (no email) 2011-06-02 08:07:41 PDT
Comment on attachment 63814 [details]
Make math.random deterministic (sans upvars)

Needs a ChangeLog.  Sounds like a good change to me, but I am not really a decision maker for SunSpider.  Then again, it seems sunspider hasn't been touche din years...