>> Suddenly mr. C gets a call from his boss. “We’ve decided
>> to rewrite our apps in JavaScript. It is pretty fast
>> nowdays, ya know.” says the boss and hangs up.
Umm... Instead of proceeding to rewrite the app and author this blog, the author could have realized that JavaScript (or Scala, Java, Python etc.) could realistically be faster than C and should have explained the same to his/her boss.
Well... You are underestimating the power of sweet spot :-) In a tight computation kernel it's actually possible for JavaScript or any other JIT compiled language given a good JIT to match the performance of C.
Also mr. C and his boss came into existence for a very particular purpose and that purpose is not "JavaScript vs. C" but rather "Normal JavaScript vs. inhuman JavaScript" comparison.
The boss did not say javascript was as fast as C, but that it was "pretty fast". As in "fast enough", with the advantage of simpler distribution.
And I'd tend to agree, a single order of magnitude difference with C out of the box? That's pretty damn good (it helps that the code is highly numerical, JITs are good at that).
Umm... Instead of proceeding to rewrite the app and author this blog, the author could have realized that JavaScript (or Scala, Java, Python etc.) could realistically be faster than C and should have explained the same to his/her boss.