Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#7320 closed enhancement (wontfix)

jQuery.now enhancement

Reported by: musicisair Owned by:
Priority: low Milestone: 1.5
Component: core Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by jitter)

Date.now is faster than (new Date()).getTime() in supporting browsers.

See jsPerf benchmarks: http://jsperf.com/date-now-vs-date-gettime and http://jsperf.com/new-date-value/3

Enhancement:

    now: Date.now || function() {
        return (new Date()).getTime();
    };

Change History (6)

comment:1 Changed 9 years ago by anonymous

p.s. the "Preview" button on this bug tracker is completely useless since the styling rules are different from the tracker's actual styles. The "preview" honors the common "four-spaces-for-code-block" markdown style. The bug tracker then F's it all up. Where is the bug tracker for the bug tracker?

comment:2 Changed 9 years ago by snover

Keywords: needsreview added
Resolution: wontfix
Status: newclosed

Seeing as how new Date().getTime() can be called at least 3 million times per second in every browser that supports Date.now(), I don’t see any reason to bloat the codebase with this. Someone else can reopen this ticket later if they strongly disagree.

Also, the styling rules for the preview are identical to the styling rules for the rest of Trac. Please read the WikiFormatting page. Prefixing space indicates blockquoting, not preformatted text.

comment:3 Changed 9 years ago by musicisair

Hey, just want to present my argument here...then I'll leave it at that. :-)

IE9, Opera, Safari, Chrome, and FF support Date.now. Since jQuery.now is used in every animation step it couldn't hurt to speed it up by adding these 12 additional characters to the code base (Date.now || ).

Sorry for my outburst yesterday...I was tired, hungry, and stumped on a project of mine. Anyway, I can guarantee the styling is different from preview to publish...at least in the case of block quotes in Chrome 8.0.552.18 dev.

comment:4 Changed 9 years ago by dmethvin

Keywords: needsreview removed

comment:5 Changed 9 years ago by snover

IE6/7 will keel over and die long before any performance benefit of Date.now could be realized in any of the browsers that support it, and every seemingly insignificant feature that gets added to core makes it bigger; cumulatively, enhancements like this are a contributor to a core library size that has doubled since version 1.2.

comment:6 Changed 9 years ago by jitter

Component: unfiledcore
Description: modified (diff)
Priority: undecidedlow
Note: See TracTickets for help on using tickets.