Skip to content

Conversation

@VladimirFokow
Copy link

@VladimirFokow VladimirFokow commented Jul 13, 2023

Implements this comment: mikepound#3 (comment)

  • replaced unnecessary int.from_bytes(data, 'big') with just data

  • cube_hash is now not an int but bytes

  • change naming: cube_hash to cube_id

  • typo correction: get_canoincal_packing

  • relevant docstring updates

replaced unnecessary `int.from_bytes(data, 'big')` with just `data`

- change naming: cube_hash to cube_id

- typo correction: get_canoincal_packing

- relevant docstring updates
@bertie2
Copy link
Owner

bertie2 commented Jul 13, 2023

thanks for the typo and doc fixes, and yes I agree this is no longer relevant to call a hash since its reversible.
also even at n=9 this saves on average 1 second so will definitely add up fast, better yet it appears to even be slightly more memory efficient so should help at n>12 scale. didn't realize python implemented comparisons on bytes so well.

merging with no further changes requested, benchmarks below:

pullrequests\VladimirFokow> python .\cubes.py --no-cache 9

Hashing polycubes n=3
completed 100.00%

Generating polycubes from hash n=3
completed 100.00%

Hashing polycubes n=4
completed 100.00%

Generating polycubes from hash n=4
completed 100.00%

Hashing polycubes n=5
completed 100.00%

Generating polycubes from hash n=5
completed 100.00%

Hashing polycubes n=6
completed 100.00%

Generating polycubes from hash n=6
completed 100.00%

Hashing polycubes n=7
completed 100.00%

Hashing polycubes n=8
completed 100.00%
Generating polycubes from hash n=8
completed 100.00%

Hashing polycubes n=9
completed 100.00%

Generating polycubes from hash n=9
completed 100.00%

Found 48311 unique polycubes

Elapsed time: 58.426s
pullrequests\bertie2> python .\cubes.py --no-cache 9

Hashing polycubes n=3
completed 100.00%

Generating polycubes from hash n=3
completed 100.00%

Hashing polycubes n=4
completed 100.00%

Generating polycubes from hash n=4
completed 100.00%

Hashing polycubes n=5
completed 100.00%

Generating polycubes from hash n=5
completed 100.00%

Hashing polycubes n=6
completed 100.00%

Generating polycubes from hash n=6
completed 100.00%

Hashing polycubes n=7
completed 100.00%

Generating polycubes from hash n=7
completed 100.00%

Hashing polycubes n=8
completed 100.00%

Generating polycubes from hash n=8
completed 100.00%

Hashing polycubes n=9
completed 100.00%

Generating polycubes from hash n=9
completed 100.00%

Found 48311 unique polycubes

Elapsed time: 60.398s

@bertie2 bertie2 merged commit 2459e21 into bertie2:overhaul Jul 13, 2023
@VladimirFokow VladimirFokow deleted the overhaul branch July 15, 2023 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants