On Thu, Jun 2, 2016 at 11:01 PM, Jori Mäntysalo <jori.mantys...@uta.fi> wrote:
> Why do we have cached results?
>
> Beginners do something like
>
> for x in small_list:
>     if x in SimpleThing(42).list():
>         echo("Found!", x)
>
> Advanced users should know how to do
>
> temp = ComplicatedThing(10^6).list()
> matches = [x for x in big_list if x in temp]
>
> So when is caching results useful?

a = some-huge-matrix
a.charpoly()  # takes 5 minutes to compute

# later on

a.charpoly() # instant

This sort of thing with matrices (say) happens all over the place deep
in complicated code.  Using caching makes it much, much easier to
write clean code that isn't stupidly slow.

 -- William

>
> --
> Jori Mäntysalo



-- 
William (http://wstein.org)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to