[Warning. mere speculation]

Perhaps it has to do with having to make a system call to get the current
time.

Alex.

On Fri, Jun 5, 2020 at 1:57 PM Paweł Badeński <pawel.baden...@gmail.com>
wrote:

> Hi,
>
> Wondering if someone can help with a bit of context to satisfy mu
> curiosity! :D
>
> We are using Date.now & new Date quite a bit in our application (financial
> domain). I run a few micro-benchmarks and was wondering why do these report
> being relatively slow (as compared to construction of other objects). In
> fact all Date methods seem rather slow. Am I having wrong expectations for
> these to be faster? Are they as fast as they could be, or is it that Date
> just never got enough love in terms of performance optimizations? Really
> curious to get more color on this!
>
> Benchmarks:
>
> Date.now() x 9,454,436 ops/sec ±1.09% (65 runs sampled)
>
> new Date() x 5,594,688 ops/sec ±1.87% (64 runs sampled)
>
> [1, 2, 3] x 124,719,052 ops/sec ±0.90% (64 runs sampled)
>
> { a: 1, b: 2, c: 3 } x 112,368,878 ops/sec ±0.83% (65 runs sampled)
>
> new Object({ a: 1, b: 2, c: 3 }) x 32,547,566 ops/sec ±0.64% (64 runs
> sampled)
>
> Source: https://stackblitz.com/edit/js-dvq8ri
>
> Thanks!
> Pawel
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-users/6d98a6eb-4961-42f3-9b7c-7c309b30ea17o%40googlegroups.com
> <https://groups.google.com/d/msgid/v8-users/6d98a6eb-4961-42f3-9b7c-7c309b30ea17o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/CABK7q5dOYX%2B5JoigNGh3ag4MG8Kcv3oF2vnb3ANyD-s0fjSgBA%40mail.gmail.com.

Reply via email to