RE: Comparing caching strategies

2023-02-18 Thread avi.e.gross
MRAB, I made it very clear I was using the translation provided by Google Translate. I copied exactly what it said and as I speak the languages involved, they seemed reasonable. I often find it provides somewhat different translations than I expect and sometimes I need to supply a longer

Re: Comparing caching strategies

2023-02-18 Thread Thomas Passin
On 2/18/2023 2:59 PM, avi.e.gr...@gmail.com wrote: I do not know the internals of any Roaring Bitmap implementation so all I did gather was that once the problem is broken into accessing individual things I chose to call zones for want of a more specific name, then each zone is stored in one of

RE: Comparing caching strategies

2023-02-18 Thread avi.e.gross
It is not an unusual pattern, Thomas, to do something selective to some object rather than do all parts just one way. The history of computing has often been one where you had to deal with scarcity of expensive resources. Consider the Python "list" as a rather wasteful container that is best

Re: Comparing caching strategies

2023-02-18 Thread MRAB
On 2023-02-18 23:04, avi.e.gr...@gmail.com wrote: [snip] Note how this can cause problems with the original idea here of caching strategies. Imagine a function that checks the environment as to what encoding or human language and so on to produce text in. If you cache it so it produces

Re: Comparing caching strategies

2023-02-18 Thread Thomas Passin
On 2/18/2023 5:55 PM, Peter J. Holzer wrote: On 2023-02-18 15:59:32 -0500, Thomas Passin wrote: On 2/18/2023 2:59 PM, avi.e.gr...@gmail.com wrote: I do not know the internals of any Roaring Bitmap implementation so all I did gather was that once the problem is broken into accessing individual

Re: LRU cache

2023-02-18 Thread Thomas Passin
On 2/18/2023 5:38 AM, Albert-Jan Roskam wrote: I sometimes use this trick, which I learnt from a book by Martelli. Instead of try/except, membership testing with "in" (__contains__) might be faster. Probably "depends". Matter of measuring. def somefunc(arg, _cache={}):     if

Re: LRU cache

2023-02-18 Thread Rob Cliffe via Python-list
On 18/02/2023 15:29, Thomas Passin wrote: On 2/18/2023 5:38 AM, Albert-Jan Roskam wrote:     I sometimes use this trick, which I learnt from a book by Martelli.     Instead of try/except, membership testing with "in" (__contains__) might     be faster. Probably "depends". Matter of

Re: LRU cache

2023-02-18 Thread Albert-Jan Roskam
On Feb 18, 2023 17:28, Rob Cliffe via Python-list wrote: On 18/02/2023 15:29, Thomas Passin wrote: > On 2/18/2023 5:38 AM, Albert-Jan Roskam wrote: >>     I sometimes use this trick, which I learnt from a book by Martelli. >>     Instead of try/except, membership

Re: Comparing caching strategies

2023-02-18 Thread Peter J. Holzer
On 2023-02-17 18:08:09 -0500, avi.e.gr...@gmail.com wrote: > Analogies I am sharing are mainly for me to wrap my head around an idea by > seeing if it matches any existing ideas or templates and is not meant to be > exact. Fair enough? Yeah. But if you are venting your musings into a public space

Re: Precision Tail-off?

2023-02-18 Thread Oscar Benjamin
On Sat, 18 Feb 2023 at 11:19, Peter J. Holzer wrote: > > On 2023-02-18 03:52:51 +, Oscar Benjamin wrote: > > On Sat, 18 Feb 2023 at 01:47, Chris Angelico wrote: > > > On Sat, 18 Feb 2023 at 12:41, Greg Ewing via Python-list > > > > To avoid it you would need to use an algorithm that computes

Re: LRU cache

2023-02-18 Thread Albert-Jan Roskam
I sometimes use this trick, which I learnt from a book by Martelli. Instead of try/except, membership testing with "in" (__contains__) might be faster. Probably "depends". Matter of measuring. def somefunc(arg, _cache={}):     if len(_cache) > 10 ** 5:         _cache.pop()    

Re: Precision Tail-off?

2023-02-18 Thread Peter J. Holzer
On 2023-02-18 03:52:51 +, Oscar Benjamin wrote: > On Sat, 18 Feb 2023 at 01:47, Chris Angelico wrote: > > On Sat, 18 Feb 2023 at 12:41, Greg Ewing via Python-list > > > To avoid it you would need to use an algorithm that computes nth > > > roots directly rather than raising to the power 1/n.

RE: Comparing caching strategies

2023-02-18 Thread avi.e.gross
David, This conversation strikes me as getting antagonistic and as such, I will not continue it here after this message. I can nitpick at least as well as you but have no interest. It is also wandering away from the original point. The analogy I gave remains VALID no matter if you do not accept

Re: Comparing caching strategies

2023-02-18 Thread MRAB
On 2023-02-18 19:59, avi.e.gr...@gmail.com wrote: [snip] I do not know the internals of any Roaring Bitmap implementation so all I did gather was that once the problem is broken into accessing individual things I chose to call zones for want of a more specific name, then each zone is stored in

Re: Comparing caching strategies

2023-02-18 Thread Peter J. Holzer
On 2023-02-18 15:59:32 -0500, Thomas Passin wrote: > On 2/18/2023 2:59 PM, avi.e.gr...@gmail.com wrote: > > I do not know the internals of any Roaring Bitmap implementation so all I > > did gather was that once the problem is broken into accessing individual > > things I chose to call zones for