|
1 | 1 | import argparse
|
2 | 2 | import gzip
|
| 3 | +import io # noqa: F401 used in timeit strings |
3 | 4 | import timeit
|
4 | 5 | import zlib
|
5 | 6 | from pathlib import Path
|
@@ -82,6 +83,8 @@ def argument_parser() -> argparse.ArgumentParser:
|
82 | 83 | parser.add_argument("--checksums", action="store_true")
|
83 | 84 | parser.add_argument("--functions", action="store_true")
|
84 | 85 | parser.add_argument("--gzip", action="store_true")
|
| 86 | + parser.add_argument("--sizes", action="store_true") |
| 87 | + parser.add_argument("--objects", action="store_true") |
85 | 88 | return parser
|
86 | 89 |
|
87 | 90 |
|
@@ -112,3 +115,18 @@ def argument_parser() -> argparse.ArgumentParser:
|
112 | 115 | benchmark("gzip decompression", compressed_sizes_gzip,
|
113 | 116 | "igzip.decompress(data_block)",
|
114 | 117 | "gzip.decompress(data_block)")
|
| 118 | + if args.objects or args.all: |
| 119 | + benchmark("zlib Compress instantiation", {"": b""}, |
| 120 | + "a = isal_zlib.compressobj()", |
| 121 | + "a = zlib.compressobj()") |
| 122 | + benchmark("zlib Decompress instantiation", {"": b""}, |
| 123 | + "a = isal_zlib.decompressobj()", |
| 124 | + "a = zlib.decompressobj()") |
| 125 | + benchmark("Gzip Writer instantiation", {"": b""}, |
| 126 | + "a = igzip.GzipFile(fileobj=io.BytesIO(), mode='wb' )", |
| 127 | + "a = gzip.GzipFile(fileobj=io.BytesIO(), mode='wb')") |
| 128 | + benchmark("Gzip Reader instantiation", {"": b""}, |
| 129 | + "a = igzip.GzipFile(fileobj=io.BytesIO(), mode='rb' )", |
| 130 | + "a = gzip.GzipFile(fileobj=io.BytesIO(), mode='rb')") |
| 131 | + if args.sizes or args.all: |
| 132 | + show_sizes() |
0 commit comments