Repository navigation
Conversation
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reading a length from
PropertyBitmaps.bitmapscan build that length's whole bitmap. That happens when the length is kept as the indices of its few good permutations. This adds a paragraph and an example toPropertyBitmaps' docstring (permuta/bisc/bisc.py), saying which reads build bitmaps and which do not. No code changes. The example: one good permutation of length 8 is kept as an index, and is read back as a bitmap of 5,040 bytes:At length 14 the same read costs 10.9 GB. So if
pb.bitmapsholds length 14 as indices:14 in pb.bitmaps,list(pb.bitmaps)andlen(pb.bitmaps)build nothing;dict(pb.bitmaps),pb.bitmaps.items(),pb.bitmaps.values(), orPropertyBitmaps(bitmaps=pb.bitmaps)build the bitmap of length 14: 10.9 GB.This matters to anyone who keeps a
PropertyBitmaps' labels between runs ofbiscorauto_bisc. The class docstring suggests doing that, andbitmapsis the natural way to read them out.Details
bitmapshad none._Bitmaps.__getitem__builds the bitmap of a length kept as indices each time it is asked for one._Bitmaps.__contains__is overridden, so thatinbuilds nothing._LengthKeys.__iter__and__len__read only the lengths.bitmapsthroughitems().bitmaps, on aPropertyBitmapsofPerm.is_increasingwith lengths 5 to 8 kept as indices:in,list()andlen()make none;items(),values(),dict()and the constructor make one for each such length;(14! + 7) // 8= 10,897,286,400 bytes.bisc.py's doctests among them. Tilings' 3,722 tests pass at itsdevelopwith this Permuta, on both Pythons.PropertyBitmaps.AI assistance: written with Claude Code (Opus 5.5) as the Permuta developer, and reviewed before submission by Claude Code (Opus 5.5) as an automated reviewer; Henning Ulfarsson checked and opened it.