5 ms·
It 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...
by StavrosK 16y ago
It 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.