Bug 20544

Summary: Sunspider: date-format-tofte has O(n) arrayExists function
Product: WebKit Reporter: Norman Rasmussen <norman>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: mjs, mrowe
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
date-format-tofte.patch none

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]
date-format-tofte.patch
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.