javascript - When asm.js is faster than normal JS code, why should I write new code in JS? -
emscripten generate faster code c/c++ js code wrote hands, means should write new code in c/c++ , compile them run on web?
i read emscripten faq, says "by means write new javascript code.", why that?
asm.js not faster way execute javascript-esque code. faster way run code reduced level of abstraction of machine code. seem overestimate gains:
- if let js developers write c++ if it's js, end fugly code that's not fast c++ , flawed in other ways too.
- many potential bottlenecks, such dom manipulation , network latency, aren't affected @ how fast code running.
- for many programs, speed faster language implementation dwarfed speed of high-level optimizations. in other words, doing work faster nice, not doing @ faster.
going route has significant downsides well:
- you have throw away working code, , re-write (including bugs) in language of team won't know well, if @ all.
- as of now, technology still in infancy. wouldn't bet company, or important product, on it. if succeeds, niche technology compared javascript. doesn't disqualify professional work, will make many things harder.
- iiuc, can't directly things js can beyond crunching numbers, can call js functions explicitly offered asm.js module. is, you'll need @ least bunch of glue code in javascript, , (as mentioned above) if includes bottlenecks, didn't gain anything.
the kinds of code expect gain enough asm.js use are:
- existing code isn't written in javascript. sole reason of saving of porting hassle.
- heavy number crunching not interacting browser. (think: how do this? , want go through effort of writing in c/c++ , wiring js?)
- stuff is, nature, @ level of abstraction asm.js supports, such compilers emitting machine code-esque instruction.
Comments
Post a Comment