4 ms·
The key to making programs fast is to make them do practically nothing. This is the Ultimate Truth of optimizing computer programs, and it seems so few people
by jrockway 16y ago
The key to making programs fast is to make them do practically nothing.
This is the Ultimate Truth of optimizing computer programs, and it seems so few people understand it.
"Why can't you make Python faster!?" Because Python does a lot of stuff without you asking.
- StavrosK 16y agoIt might be the Ultimate Truth, but it also begs the question. Of course you need to make programs do less, the question is how you actually do it...
- j_baker 16y agoHe didn't say it was the Complete Ultimate Truth, did he?
- StavrosK 16y agoIt's just a truism. You make things faster by making them faster.
- dasil003 16y agoIt's not just a truism. It's like a koan. It's meant to make you think about what you really need.
- RiderOfGiraffes 16y agoNo, you don't make things faster by making them faster. You can't make your computer do things faster. You can only make it do less.
- JeanPierre 16y agoI have to disagree, and I could actually use Boyer-Moore as an example on this: Split the string you're searching into four roughly equal pieces, with an overlap so that potential matches is guaranteed to be found. Then do a Boyer-Moore on those in parallel. E.g. if you look after FOO, you'd have to split the string like this (pipes are the start/end of the piece exclusive, i.e. piece 1 does not contain the last O) piece 1 here| ...7890abcdeFOOghijk |piece 2 here Now, what we know is that in the worst cases, this would require more operations: The O may be detected by piece 1, and it will check if the character in front is an O as well. Piece 2 will also check the same O, so there's redundant computation going on. However, this is theoretically faster (I'd guess it is practically faster for large files) even though this requires more operations.
- xpaulbettsx 16y agoAnother way of putting this was from an nVidia developer deck I once read: the fastest triangle you can render is the one you don't render at all.
- crasshopper 16y agoI thought the Ultimate Truth of optimizing computer programs was: Premature optimization is the root of all evil.
- nostrademons 16y agoIf you're doing it right, then by the time you've decided to optimize, it's no longer premature.
- crasshopper 16y agoIsn't that the same as what I said above?
- gaius 16y agohttp://www.jwz.org/doc/easter-eggs.html http://www.jwz.org/doc/easter-eggs.html Mozilla is not big because it's full of useless crap. Mozilla is big because your needs are big. Your needs are big because the Internet is big. There are lots of small, lean web browsers out there that, incidentally, do almost nothing useful
- crasshopper 16y agoWhich browsers? uzbl? midori? seamonkey? lynx?