Skip to content

Commit b8f55f1

Browse files
committed
Add benchmarks scripts for writing
1 parent 755b815 commit b8f55f1

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import sys
2+
import os
3+
4+
from isal import igzip
5+
6+
with open(sys.argv[1], "rb") as in_file:
7+
with igzip.open(os.devnull, "wb") as out_gzip:
8+
while True:
9+
block = in_file.read(128 * 1024)
10+
if block == b"":
11+
break
12+
out_gzip.write(block)

benchmark_scripts/gzipwritelines.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import sys
2+
import os
3+
4+
from isal import igzip
5+
6+
with open(sys.argv[1], "rb") as in_file:
7+
with igzip.open(os.devnull, "wb") as out_gzip:
8+
for line in in_file:
9+
out_gzip.write(line)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import cProfile
2+
import os
3+
import sys
4+
5+
from isal import igzip
6+
7+
8+
def main():
9+
with open(sys.argv[1], mode="rb") as in_file:
10+
with igzip.open(os.devnull, mode="wb") as gzip_h:
11+
for line in in_file:
12+
gzip_h.write(line)
13+
14+
15+
if __name__ == "__main__":
16+
cProfile.run("main()")

0 commit comments

Comments
 (0)