Skip to content

Commit

Permalink
Minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
TLCFEM committed Oct 23, 2024
1 parent 927d1f8 commit 0ea0c56
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions tests/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations

import functools
import os
import random
import string
from multiprocessing import Pool

import msgpack # type: ignore

Expand Down Expand Up @@ -111,7 +108,7 @@ def configure_and_dump(archive, block):


def generate(*, depth=6, width=11, threshold=23):
archive = {"id": generate_deterministic_json(depth, width)}
archive = {"id": generate_random_json(depth, width)}
path = find_all_paths(archive)
indices = list(range(0, min(1_000_000, len(path))))
random.shuffle(indices)
Expand All @@ -123,12 +120,8 @@ def generate(*, depth=6, width=11, threshold=23):
with open("archive_msgpack.msg", "wb") as f:
msgpack.dump(archive, f)

_dump = functools.partial(configure_and_dump, archive)

step = range(13, threshold + 1)

with Pool(min(os.cpu_count(), len(step))) as p:
p.map(_dump, step)
for step in range(13, threshold + 1):
configure_and_dump(archive, step)


def compare(mode, size: int = 13, total: int = 5, unpacker: Unpacker = None):
Expand Down

0 comments on commit 0ea0c56

Please sign in to comment.