4 ms·
The code looks nice, I hope it has helped you in your life. But frankly, if a JavaScript developer ever really wants to solve the problem... Learn enough C++ t
by cjhanks 8y ago
The code looks nice, I hope it has helped you in your life.
But frankly, if a JavaScript developer ever really wants to solve the problem... Learn enough C++ to write the equivalent code that compiles 6.5M in 0.1 seconds (assuming a nice HD).
- nemothekid 8y agoC++ doesn't even compile 6.5M of C++ in .1 seconds.
- cjhanks 8y agoIf you do absolutely zero instruction optimization or re-ordering. Literally mapping the BNF grammar to a syntax tree capable of simple syntactic reduction... I would be surprised if it did not lag behind disk read speeds. Traversing that tree to remove unambiguous dead branches seems pretty clear. Perhaps if you get into a tricky manipulation between strings and syntax you could add a little runtime...
- yzmtf2008 8y agoIf you do absolutely zero instruction optimization or re-ordering, JavaScript takes 0 seconds to compile, and you can use almost-complete feature set of ES6. /s Come on man, that's beyond the point. Just because JavaScript needs to be compiled, doesn't mean it has a worse experience than compiling C++.
- cjhanks 8y agoInstruction optimization is procedure of measuring expected CPU latency given the expected current state to identify which instruction set transition is optimal for the CPU. It would not be applicable to JavaScript unless I missed something. Instruction ordering is largely bound to instruction pipelining and the estimation of CPU instruction transitioning to reduce latency. Given that V8 uses some degree of virtual indirection... I don't think that's possible in JavaScript.
- voltagex_ 8y agoDo you know enough C++ to try that? I'd be really interested to see the results - I'm not sure language is the bottleneck.
- cjhanks 8y agoYes.
- tomnipotent 8y agoOh no! One language has a build process and toolchain... We should clearly throw everything else out and just use this one hammer for everything! /s Believe it or not, some people have problems in domains with contexts that have nothing to do with yours and the things they come up with are equally valid solutions.
- cjhanks 8y agoIt is not a question of C++ being better than JavaScript or vice-versa in some esoteric sense. Compiling code from C++ to WASM is counter-productive if the native JavaScript is fine. It's just that native languages seem to perform quite a bit better in the domains of graph construction, graph optimization, and even basic string manipulation.
- tomnipotent 8y ago> Compiling code from C++ to WASM is counter-productive When did WASM come into the picture? I use Parcel because my time is valuable and I don't want to master the arcane arts of modern JS build toolchains but I still NEED to benefit from them if I'm to run a successful business and make sure my investors get their money back and a language I can deliver plain text over HTTP/S that runs performantly across billions of devices that I can modify on the fly is beyond valuable. > native languages C++ isn't going to help me deliver my product to my customers in any measurable way that influences the outcome of our relationship. JavaScript, frankly, does - the less time my organization spends writing code, the less we have to charge for things to make up for that margin impact.
- cjhanks 8y agoWhat do you want me to say? Maybe you have reading comprehension issues?
- tomnipotent 8y agoYou brought up C++ & WASM in a post where it made absolutely NO contextual sense so you could shit on someones work and I'm the one with comprehension issues? Grow up.
- rydel 8y agoThis is fine argument. Although I work primarily in JS, I don’t think that this is the tool for any job. There are lot of nice tools in JS out there. While using single tool written in JS it might be not looks slow, but when you must use multiple of them in day to day work it start be a problem. To sum up: I don’t think JS was designed to build such tools. Although it is very nice language to write in, it is not so efficient in runtime.
- cjhanks 8y agoI agree.
- modernerd 8y agoOthers feel the same. Fastpack is a binary JS bundler written in OCaml: http://fastpack.io/ http://fastpack.io/ It’s new and missing some features (http://fastpack.io/docs/get-started.html http://fastpack.io/docs/get-started.html ), but already faster than Webpack / Parcel. It also supports Webpack loaders.
- Hurtak 8y agoSo it is 3 times faster than Webpack, ATM it does not seem worth to be switching to this. Also the Parcel comparison seems wrong (maybe they are using too old version of Parcel?), see Parcels own benchmarks https://github.com/parcel-bundler/parcel#benchmarks https://github.com/parcel-bundler/parcel#benchmarks