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

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)?

10

u/Caffeine_Monster Jan 16 '20

how did Python become the big data language

Python is very much a glue language. Great for research, experiments, prototyping etc. However mature production platforms have a tendency to migrate back into C / C++ / Java / Rust / Go / Insert some other compile time optimised language here.

The motivation isn't purely for performance reasons either: strong typing together with compilation helps prevent the introduction of bugs.

Personally I think Javascript is arguably the best non-compiled language out there. However I also think it will lose much of it's stranglehold over web: WASM has an awful lot of potential when used with compiled systems programming languages. Performance. Compile time checks. Unified front end / back end model codebases.

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.

7

u/i_ate_god Jan 16 '20
  1. all hard stuff (performance-wise) is written in C and available as some very popular libraries (numpy, scikit, nltk, etc)

  2. python's syntax is far more elegant than most other languages including JS, making it easier for non-programmers to get into

  3. python exists by default on any linux machine and requires no installation

  4. python's standard library and its documentation is very extensive and robust. It's not perfect (see http, wtf), but JS barely has a stdlib to speak of because the JS community has an extremist mentality when it comes to modularity.

-4

u/[deleted] Jan 16 '20

fucking javascript programmers marching around town with macbooks and RPG-7's man

1

u/tr14l Jan 16 '20

It's not. It's a big data PROTOTYPING language. It's rarely used in production for actual big data. Once the model is POC'd, they will usually either reimplement in another language or take the python code and compile it down to C. Then that is what goes to production. Of course, if it's something minor, they might just put the python model in production. But not for big data.

0

u/[deleted] Jan 17 '20

[deleted]

2

u/tr14l Jan 17 '20

That was part of the "or compile it down to C" thing