5 ms·
So just because shared memory is hard you are ok with sacrificing performance and replacing memory access with io hops? That sounds like an overkill and not sui
by Gonzih 9y ago
So just because shared memory is hard you are ok with sacrificing performance and replacing memory access with io hops? That sounds like an overkill and not suitable for every task.
- egeozcan 9y agoI like node.js and use it very often (had my first package reach over 100 stars, woohoo :) ) but I don't understand why it needs to be suitable for every task. If you really want to do something creative with the shared memory, I guess you could do that in a "native module" written in c++ or even Rust[1]. I'm not saying that it's not doable with JS, it's just that it's already been done (as in, has a solution that works). [1]: https://github.com/neon-bindings/neon https://github.com/neon-bindings/neon
- PunchTornado 9y agoWhy should i learn a new language for that? It's good to have as many options as possible in js and you take the one that fits you best.
- bovermyer 9y agoWhen all you have is a hammer...
- flavio81 9y ago... everything looks like a nail!
- epicide 9y agoBecause JS isn't good at everything just like C++ and Rust aren't good at everything. Right tool for the job.
- RussianCow 9y agoBut if you take that to an extreme, you end up with a hundred tools. I think it's good to have the option to do parallel computing in JS, for those times when it's worth the tradeoff versus having to adopt a completely new language/platform.
- datavirtue 9y agoWe have been down this road before. When you have a lot of options "for those times when" you get a lot of abuse. All good frameworks remove choice to prevent a spiraling string of fuckups by people who don't understand what is going on behind their code. For the few of us who do know what is going on it is not a problem but you have to consider all of the code monkeys who are going to be using a given framework without supervision. What would happen if we made everyone program enterprise CRUD applications in C++ from scratch....unmitigated chaos that would lead the business to disavow technology and go back to paper filing cabinets.
- RussianCow 9y agoYou call it "abuse", I call it resourcefulness. I get where you're coming from, but as someone who is not very comfortable with lower-level languages like C++ and Rust, it's great to have the option of whipping together a parallel program in a language/platform I know, rather than having to invest in learning a new one. For longer-term projects, that investment is generally worth it, but I don't think it's useful to be dogmatic about "the right tool for the job". > What would happen if we made everyone program enterprise CRUD applications in C++ from scratch I don't think that's a good analogy. A better analogy would be if we started writing everything in JS/Ruby/Python instead of using lower-level languages where performance matters. Except, this is regularly done with great success by many, many companies, so I don't think that helps your point. Sure, you may have to eventually port it to a more performant platform when you hit massive scale, but that point may also never come.
- cjalmeida 9y ago
- gnaritas 9y agoBecause languages are tools, and you should learn to use more than one tool. If you know JavaScript, you basically already know most C based languages syntactically, it's very little effort to at least learn one of them for tasks JS isn't suited for.
- flavio81 9y ago>Why should i learn a new language for that? You make it sound like it was difficult to learn. Underneath, C++, Java, Pascal, C#, Javascript and Python, have many similarities and jumping from one of those languages to another in the list is very easy; compared, for example, to something like jumping from any of those languages to Forth, PROLOG, SQL, ML, Haskell, or Lisp. Some of them are also really similar syntactically, for example this group: [C, C++, Java, C#]; or this other group: [Pascal, Algol, Go], so even the syntax doesn't get in the way when jumping from one to other. Thus, usually, software engineers do know more than one language and they apply what better suits the program.
- Gonzih 9y agoBut what about dealing with ffi, build dependencies and toolchains? Sounds like it is just shifting complexity in to a different place, not actually solving it.
- maxpert 9y agoHave you read the docs? Just go read this https://github.com/Microsoft/napajs/blob/master/docs/api/memory.md https://github.com/Microsoft/napajs/blob/master/docs/api/mem... and tell me you don't feel uncomfortable. This is the kind of baggage you are bound to get with such solutions and once you end up writing a steaming pile of code, then you need a thread safe logging and debugging story.