Friday, March 1, 2013

Someone should really fix that



Well there is a fantastic set of slides entitled: "Why python, ruby, and javascript are slow"


It is right here and you should go read it. but I can sum it up for you by copying a couple of slides

First: here is how you might define a point in C:

struct Point {
   double x;
   double y;
   double z;
};
Ok, thats nifty, lets do that in javascript:
var point = {
   'x':x,
   'y':y,
   'z':z
}
Correct so far, that is pretty much how you'd do that in javascript. But what you are really doing can be best explained by doing a literal translation of the javascript back into C:
std::hash_set<std::string, double> point;
point["x"] = x;
point["y"] = y;
point["z"] = z;
"If you put this in a code review, first your coworkers would laugh alot, and then they'd make mean jokes about you for the next year."

Nobody will laugh at you for doing it in javascript, because that is the best that we've got.

Someone should really fix that.

No comments: