On 29 May 2017, at 5:48pm, Jeffrey Mattox <j...@mac.com> wrote: > Why does a complex computation (but still consisting of only constants) make > a difference as to whether the computation is performed once or many times? > What's the dividing line between "simple" and "complex"?
Your program has a task to do. You can do it once up-front and save the result, or you can do it a hundred times. If that’s all you know, then you’d choose to do it once up-front, right ? Then you find out that allocating, then releasing, the memory needed to save the result takes as much time and effort as doing a really simple calculation 200 times, but a really complicated calculation only 5 times. So sometimes it’s better to chose one option, other times it’s better to choose the other. Since you are fiendishly passionate about execution speed you diligently write both routines into your program and have it figure out which one to use. So now you have the best of both worlds: your program always picks whichever the best solution is. And then you find out that the test your program has to do to figure out which the best solution would be takes as much time and memory as doing a simple calculation 50 times. So a lot of the time it’s better just to make an assumption. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users