Thanks, that bit makes sense. Though doesn't getTime() produce a number and
if so what's the difference between an explicit and implicit conversion to
a primitive value?

On 8 October 2012 11:10, Florian Schneider <[email protected]> wrote:

> This is expected: When comparing two objects like Date with <, they are
> converted into primitive values (numbers) first. This
> ToPrimitive-conversion takes most of the time when comparing two Date
> objects. Comparing the result of getTime() on the other hand is just a
> comparison of two numbers which is way more efficient.
>
> 2012/10/5 Matthew Caruana Galizia <[email protected]>
>
>> One of my colleagues wrote a 
>> test<http://jsperf.com/date-comparison-test>that shows that comparing two 
>> Date objects is ~95% slower than comparing
>> against the result of getTime. Why is this so?
>>
>> --
>> v8-users mailing list
>> [email protected]
>> http://groups.google.com/group/v8-users
>
>
>  --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to