> +        for c in iter(functools.partial(fp.read, chunksize), b''):
> +            chunk += c
> +            try:
> +                p = chunk.rindex(b'\n')
> +                self.entries |= set(decodedir(chunk[:p + 1]).splitlines())

Nit: you can `entries.update(any_iterable)` which would be slightly faster
when bucket size changes.

>   Right now this patch does not have any tests. How should I add them?
>   
>   1. add a debug config option and pass that to fncachestore and then to 
> fncache
>   2. have a function which returns the chunk_size, write an extenion in tests 
> which wrap that function and enable that extension in tests

Something like 2. `chunksize` can be a module constant, which can later be
updated by an extension. That's probably the easiest option.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to