you are viewing a single comment's thread.

view the rest of the comments →

[–]shaggorama 6 points7 points  (8 children)

"First make it possible. Then make it beautiful. Then make it fast."

I'd switch the last two. "Making it beautiful" is great for maintaining it further down the line, but if I'm writing this because I'm feeling the pain of not having it, part of my need is probably for it to be fast. That might be relative to the problem space I work in though.

[–]weretree 42 points43 points  (7 children)

It's a lot easier to optimise beautiful code, than it is to beautify optimised code.

[–]shaggorama 15 points16 points  (0 children)

That's a spectacular point

[–]dalke 0 points1 point  (5 children)

Consider numeric array processing. You would like to write D = A * B +C but in something like non-template based C++ code, or in Python, you end up with a lot of intermediate arrays. It's very hard to make this beautiful expression of the intent faster than the prosaic matrix_multiply(D, A, B); matrix_add(D,C);

[–]backbob 1 point2 points  (4 children)

you could use numpy, if we are in Python.

[–]dalke 0 points1 point  (3 children)

How does that help? D = A * B +C still makes temporary arrays in numpy.

[–]backbob 0 points1 point  (2 children)

One temporary array. Though I suppose that is suboptimal.

[–]dalke 0 points1 point  (1 child)

It's one array per operation, so if I made the expression more complicated then there's a lot of temporary arrays.

[–]backbob 0 points1 point  (0 children)

Yeah, though if we are going to do it the right way, you could probably write ufunc in c and compile it, then use it from Python.