Ask coding questions

← Back to all posts
javascript slow in
MrEconomical (2196)

When I run my simple js-speed program in, it produces times of roughly 4 ms for 1,000 ops, 2500 ms for 1,000,000 ops, and the last 1 billion ops test takes a very long time. However, when I run it in the chrome javascript console, it is extremely fast.

Is there a reason why repl is so slow?

Answered by Vandesm14 (2217) [earned 5 cycles]
View Answer
Vandesm14 (2217)

Because is a VM that streams its output over the internet. This is different from the dev console in Chrome which is instant as it's local and doesn't require a connection.

fyreco (7)

this is a test comment

amasad (2382)

As @Vandesm14 mentioned, your code runs on our cloud infrastructure which is shared with other users. As a Hacker subscriber you get priority but it still wouldn't compare to a local powerful machine like such as a MacBook.

If you want local JavaScript on I suggest using the html language which runs clientside.