On 14 Sep 2017, at 3:08pm, Darko Volaric <li...@darko.org> wrote:

> I think people are missing the point, probably becuase it's not a great 
> example. Consider the following statement:
> 
> SELECT funca(slow(10)), funkb(slow(10))
> 
> and lets say slow(10) takes an hour to compute, and funka and funkb take 
> almost no time to execute. With common subexpression optimization the 
> statement would take one hour, instead of two, to compute becuase the value 
> of slow(10) would only be calculated once.

Thing of how hard that is to implement, though.  You have to keep a cache of 
each deterministic function and the parameters it was given and the result.  
You have to search through the cache every time you evaluate a deterministic 
function.  You have to allocate and free the memory this cache takes up.  You 
have to figure out a strategy for how long you keep results in the cache.  And 
the best strategy depends on something the SQLite developers can’t tell about 
your programming, so whatever they choose some people will complain.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to