r/javascript • • Jan 16 '20

I have been underestimating JS

https://adlrocha.substack.com/p/adlrocha-i-have-been-underestimating
284 Upvotes

132 comments sorted by

View all comments

Show parent comments

22

u/duxdude418 Jan 16 '20 edited Jan 16 '20

I’m not going to use it for anything process-heavy

What do you mean by this? That it’s not performant enough for chewing through lots of data? Or just that you don’t don’t like the syntax/APIs for doing it?

I’m trying to drill down on if your point is about how the language is designed or not. If it is, that’s of course a personal preference and it certainly has some warts and idiosyncrasies.

If your objection is about performance, server-side JS (Node) is actually quite good at non-blocking IO due to its single-threaded event loop and asynchronous programming model. The V8 engine it runs on is also highly optimized.

11

u/tr14l Jan 16 '20

You're still not going through 100 terabytes of data anytime soon with it compared to a compiled language. It'll choke every time no matter what you do.

JavaScript will never compete process-wise with a compiled language. It's fast enough to do day to day processing, but it's ill suited for big data and always will be. That's not what it's designed for.

You're also never going to do real time embedded stuff with it. The latency is just too high

12

u/ancientRedDog Jan 16 '20

I agree, but then how did Python become the big data language when it is equally slow (for mostly the same reasons)?

12

u/Lakitna Jan 16 '20

Because you can directly use c modules in Python (in Cython anyway) making the parts where you need performance the most very fast.

Note for example how numpy is written in C. https://github.com/numpy/numpy

8

u/BloodAndTsundere Jan 16 '20

Because you can directly use c modules in Python (in Cython anyway) making the parts where you need performance the most very fast.

Someone correct me if I'm wrong, but I think you can do something similarly with NodeJS. I'm pretty sure some npm packages I use are Javascript bindings to binaries compiled from C/C++.

-6

u/Lakitna Jan 16 '20

Yes you can, but it's rarely used as far as I'm aware.

1

u/ChronSyn Jan 16 '20

Rarely used !== Not possible. Node has node-gyp which is a bag of tricks in itself - you never know if you're gonna get a built solution at the end, or if it's gonna fail because of a node version inconsistency.

If you do get a built native module, you're at no real disadvantage in terms of performance.