Skip to content

Use bwparser instead of native, if available #24

@thelabcat

Description

@thelabcat

https://github.com/thelabcat/cookworm-c

In [37]: def ratio_test():
    ...:     start = time.time()
    ...:     p = subprocess.Popen(["bwparser"], stdin=subprocess.PIPE
       ⋮ , stdout=subprocess.PIPE, text=True)
    ...:     coutraw, err = p.communicate(input=data)
    ...:     p.kill()
    ...:     cout = coutraw.strip().splitlines()
    ...:     mark1 = time.time()
    ...:     pout = cookworm.unpack_wordlist(data)
    ...:     mark2 = time.time()
    ...:     return (mark2 - mark1) / (mark1 - start)
    ...:

In [38]: sum([ratio_test() for i in range(50)]) / 50
Out[38]: 2.3839193407044785

So, even with Python handling, using the bwparser binary is around 2.38 x faster.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions