From e9cb49f87b33936b418cc6a1b4d3b8241abdfa5b Mon Sep 17 00:00:00 2001 From: Henning Ulfarsson Date: Fri, 6 Nov 2026 16:58:57 +0000 Subject: [PATCH 1/2] Document the memory cost of reading PropertyBitmaps.bitmaps PropertyBitmaps.bitmaps builds the bitmap of a length kept as the indices of its good permutations each time it is asked for it, so items(), values() and dict(bitmaps), or bitmaps given to another PropertyBitmaps, build every such length's bitmap: 10.9 GB for length 14. Asking whether a length is there, iterating over the lengths and len() build none. The class docstring said so until the last commit of #209 shortened it, and no other docstring says it now. This puts the note back, in the shortened docstring's style. Co-Authored-By: Claude Opus 5.5 --- permuta/bisc/bisc.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/permuta/bisc/bisc.py b/permuta/bisc/bisc.py index 595f060..75df7c5 100644 --- a/permuta/bisc/bisc.py +++ b/permuta/bisc/bisc.py @@ -511,6 +511,12 @@ class PropertyBitmaps: permutations, in lexicographic order. `good_counts` maps each length to its number of good permutations, and `bitmaps` to its bitmap. + `bitmaps` builds the bitmap of a length kept as indices each time it is + asked for it, so `items()`, `values()` and `dict(bitmaps)`, or `bitmaps` + given to another `PropertyBitmaps`, build every such length's bitmap: + 10.9 GB for length 14. Asking whether a length is there, iterating over + the lengths and `len()` build none. + Examples: >>> pb = PropertyBitmaps(Perm.is_increasing) >>> pb.add_length(3) From 8dd1418ecce9c2cbeb5dca78063f9d2c48289848 Mon Sep 17 00:00:00 2001 From: Henning Ulfarsson Date: Fri, 6 Nov 2026 17:10:06 +0000 Subject: [PATCH 2/2] Add an example of PropertyBitmaps.bitmaps to its docstring bitmaps had no example among the class's doctests. This one reads a length kept as the index of its one good permutation through bitmaps, which builds its whole bitmap, 5,040 bytes at length 8: the cost the paragraph above the examples describes. Co-Authored-By: Claude Opus 5.5 --- permuta/bisc/bisc.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/permuta/bisc/bisc.py b/permuta/bisc/bisc.py index 75df7c5..f27a2fb 100644 --- a/permuta/bisc/bisc.py +++ b/permuta/bisc/bisc.py @@ -526,6 +526,9 @@ class PropertyBitmaps: [Perm((0, 1, 2))] >>> len(pb.bad[3]) 5 + >>> pb.add_length(8) + >>> pb.good_counts[8], len(pb.bitmaps[8]) + (1, 5040) """ def __init__(