forked from python/typed_ast
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request python#30 from python-lz4/development
Development branch fixes for 0.9.1 release
- Loading branch information
Showing
11 changed files
with
78 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ python: | |
- 3.3 | ||
- 3.4 | ||
- 3.5 | ||
- 3.6 | ||
install: | ||
script: python setup.py test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,6 @@ SOFTWARE. | |
|
||
#include <py3c/comparison.h> | ||
#include <py3c/compat.h> | ||
|
||
#include <py3c/py3shims.h> | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* Copyright (c) 2016, Red Hat, Inc. and/or its affiliates | ||
* Licensed under the MIT license; see py3c.h | ||
*/ | ||
|
||
/* | ||
* Shims for the PyMem_Raw* functions added inPython 3.3 | ||
* | ||
* See https://docs.python.org/3/c-api/memory.html#raw-memory-interface | ||
*/ | ||
|
||
#ifndef _PY3C_RAWMALLOC_H_ | ||
#define _PY3C_RAWMALLOC_H_ | ||
#include <Python.h> | ||
#include <stdlib.h> | ||
|
||
|
||
#if PY_MAJOR_VERSION < 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 4) | ||
#define PyMem_RawMalloc(n) malloc((n) || 1) | ||
#define PyMem_RawRealloc(p, n) realloc(p, (n) || 1) | ||
#define PyMem_RawFree(p) free(p) | ||
#endif /* version < 3.4 */ | ||
|
||
|
||
#if PY_MAJOR_VERSION < 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 5) | ||
#define PyMem_RawCalloc(n, s) calloc((n) || 1, (s) || 1) | ||
#endif /* version < 3.5 */ | ||
|
||
|
||
#endif /* _PY3C_RAWMALLOC_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
import uuid | ||
import timeit | ||
import lz4 | ||
import snappy | ||
import os | ||
from timeit import Timer | ||
import sys | ||
import blosc | ||
|
||
DATA = open("../src/lz4.c", "rb").read() | ||
LZ4_DATA = lz4.compress(DATA) | ||
SNAPPY_DATA = snappy.compress(DATA) | ||
LOOPS = 200000 | ||
DATA = open(sys.argv[1], "rb").read() | ||
LZ4_DATA = lz4.block.compress(DATA) | ||
BLOSC_DATA = blosc.compress(DATA, cname='lz4', clevel=5, shuffle=True) | ||
LOOPS = 100 | ||
|
||
print("Data Size:") | ||
print(" Input: %d" % len(DATA)) | ||
print(" LZ4: %d (%.2f)" % (len(LZ4_DATA), len(LZ4_DATA) / float(len(DATA)))) | ||
print(" Snappy: %d (%.2f)" % (len(SNAPPY_DATA), len(SNAPPY_DATA) / float(len(DATA)))) | ||
print(" LZ4 / Snappy: %f" % (float(len(LZ4_DATA)) / float(len(SNAPPY_DATA)))) | ||
print(" Blosc: %d (%.2f)" % (len(BLOSC_DATA), len(BLOSC_DATA) / float(len(DATA)))) | ||
print(" LZ4 / Blosc: %f" % (float(len(LZ4_DATA)) / float(len(BLOSC_DATA)))) | ||
|
||
print("Benchmark: %d calls" % LOOPS) | ||
print(" LZ4 Compression: %fs" % Timer("lz4.compress(DATA)", "from __main__ import DATA; import lz4").timeit(number=LOOPS)) | ||
print(" Snappy Compression: %fs" % Timer("snappy.compress(DATA)", "from __main__ import DATA; import snappy").timeit(number=LOOPS)) | ||
print(" LZ4 Decompression: %fs" % Timer("lz4.uncompress(LZ4_DATA)", "from __main__ import LZ4_DATA; import lz4").timeit(number=LOOPS)) | ||
print(" Snappy Decompression : %fs" % Timer("snappy.uncompress(SNAPPY_DATA)", "from __main__ import SNAPPY_DATA; import snappy").timeit(number=LOOPS)) | ||
print(" LZ4 Compression: %fs" % (Timer("lz4.block.compress(DATA)", "from __main__ import DATA; import lz4").timeit(number=LOOPS)/LOOPS)) | ||
print(" Blosc Compression: %fs" % (Timer("blosc.compress(DATA, cname='lz4', clevel=5, shuffle=True)", "from __main__ import DATA; import blosc").timeit(number=LOOPS)/LOOPS)) | ||
print(" LZ4 Decompression: %fs" % (Timer("lz4.block.decompress(LZ4_DATA)", "from __main__ import LZ4_DATA; import lz4").timeit(number=LOOPS)/LOOPS)) | ||
print(" Blosc Decompression : %fs" % (Timer("blosc.decompress(BLOSC_DATA)", "from __main__ import BLOSC_DATA; import blosc").timeit(number=LOOPS)/LOOPS)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters