←back to thread

160 points todsacerdoti | 1 comments | | HN request time: 0s | source
Show context
jpalawaga ◴[] No.41898791[source]
Anyone who has done a programming contest, advent of code, etc knows that the language doesn’t matter so much as your algorithm.

Yes, the language can bring a nice speed up, or might give you better control of allocations which can save a lot of time. But in many cases, simply picking the correct algorithm will deliver you most of the performance.

As someone who doesn’t JavaScript a lot, I’d definitely prefer a tool written in go and available on brew over something I need to invoke node and its environment for.

replies(12): >>41898816 #>>41898879 #>>41898890 #>>41898952 #>>41899000 #>>41899028 #>>41899401 #>>41901158 #>>41901185 #>>41901525 #>>41902030 #>>41904514 #
tightbookkeeper ◴[] No.41898890[source]
> knows that the language doesn’t matter so much as your algorithm.

I know what you’re referring to but these problems have also taught me a lot about language performance. python and JS array access is just 100x slower than C. Some difficult problems become much harder due to this limitation.

replies(1): >>41898967 #
jampekka ◴[] No.41898967[source]
JS array access is a lot faster than Python array access. JS is easily within magnitude of C and can be even about as fast with typed arrays or well JITable code.
replies(1): >>41899140 #
tightbookkeeper ◴[] No.41899140[source]
> JS is easily within magnitude of C

Typed arrays help a lot, but I’m still doubtful. Maybe it all the processing is restrict to idioms in the asm.js subset? And even then you’re getting bounds checking.

replies(1): >>41899241 #
jampekka ◴[] No.41899241[source]
In benchmarks JS is usually well within magnitude (i.e. under 10x slower).

E.g. C++ vs Node.js here: https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Couldn't find C vs JS easily with the new benchmarksgame UI.

replies(2): >>41899295 #>>41899458 #
1. igouy ◴[] No.41899458{5}[source]
> Couldn't find C vs JS easily

Try:

A) Find JS in the box plot charts

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

or

B) Find JS in the detail

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...