Bug 20544 - Sunspider: date-format-tofte has O(n) arrayExists function
Summary: Sunspider: date-format-tofte has O(n) arrayExists function
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2008-08-27 08:22 PDT by Norman Rasmussen
Modified: 2008-08-28 02:34 PDT (History)
2 users (show)

See Also:

date-format-tofte.patch (1.64 KB, patch)
2008-08-27 08:24 PDT, Norman Rasmussen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Norman Rasmussen 2008-08-27 08:22:37 PDT
The attached patch removes the arrayExists function and converts switches from a list to a hash.

The reasoning for this patch has nothing to do with WebKit at all, but the new Firefox 3.1 JS jit runs approx 180x times _slower_ (than the non-jit code) without this patch.

With this patch the code runs at mostly the same speed.

So the patch makes the test, actually test the string formatting, and not strange tight-loops created by non-core array functions.  (The test is meant to test string formatting, not array.exists functionality)
Comment 1 Norman Rasmussen 2008-08-27 08:24:12 PDT
Created attachment 23032 [details]
Comment 2 Norman Rasmussen 2008-08-27 08:34:51 PDT
in case anyone cares, the bug exists on the mozilla side here: https://bugzilla.mozilla.org/show_bug.cgi?id=451942
Comment 3 Mark Rowe (bdash) 2008-08-27 11:40:15 PDT
Changing SunSpider to work around a performance bug in Mozilla's new JS engine is not a good idea.  The code in the benchmark may not be great JavaScript, but it is representative of JS code on the web. It highlights an important regression in Mozilla's code which I'm sure they'll be happy to fix.
Comment 4 Norman Rasmussen 2008-08-28 02:34:48 PDT
Agreed, no complaints about the resolution.