Closed Bug 2027064 Opened 2 months ago Closed 1 month ago

Slower than JSC at calling `Date.now = () => +new Date('2023-05-12T08:35:00');`

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: mstange, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: perf, Whiteboard: [sp3])

Attachments

(1 file)

Attached file microbenchmark

On the Perf-Dashboard subtest of sp3, Date.now has been stubbed out as follows:

Date.now = () => +new Date('2023-05-12T08:35:00');

https://github.com/WebKit/Speedometer/blob/6cd673574812cf63ec1b497b15ec7397f0356cfc/resources/perf.webkit.org/public/v3/index.html#L39

On the attached microbenchmark, I get 435ms in Firefox and 231ms in Safari Technology Preview 227, i.e. Safari being 1.9x faster.

Doubling our speed here may give us a 1% win on the Perf-Dashboard subtest.

See bug 2026748 comment 4 for more context.

In the linked comment I mention two possible approaches for speeding this up: a one-element cache when parsing Dates, and CacheIR support for converting Dates to number. I got Claude to prototype the second approach; it brings us within ~15% of jsc. If we also do the one-element cache, I think we should be significantly faster.

Depends on: 2027192
Depends on: 2027644
Severity: -- → N/A
Priority: -- → P3
Depends on: 2029973

Should this bug get the "PERF" key word? I can do it if someone can fix that for me. Thank you.

Keywords: perf

This looks well and truly fixed now. Thanks anba and Iain!

I now get 64ms in Firefox, down from 435ms and way lower than Safari's ~200ms.

Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: