-
-
Notifications
You must be signed in to change notification settings - Fork 18k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAS7BDAT parser: Speed up RLE/RDC decompression (#47405)
* Speed up RLE/RDC decompression * Update tests * ssize_t -> size_t * Update sas.pyx * Don't use null byte as except value * Nit * Simplify condition * Review feedback * Docstring -> comment * Revert "Simplify condition" This reverts commit 263aea6. * Lint * Speed up some Cython `except` * Typo
- Loading branch information
Showing
3 changed files
with
150 additions
and
123 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 |
---|---|---|
@@ -1,30 +1,23 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
from pandas import read_sas | ||
|
||
ROOT = Path(__file__).parents[3] / "pandas" / "tests" / "io" / "sas" / "data" | ||
|
||
|
||
class SAS: | ||
def time_read_sas7bdat(self): | ||
read_sas(ROOT / "test1.sas7bdat") | ||
|
||
params = ["sas7bdat", "xport"] | ||
param_names = ["format"] | ||
def time_read_xpt(self): | ||
read_sas(ROOT / "paxraw_d_short.xpt") | ||
|
||
def setup(self, format): | ||
# Read files that are located in 'pandas/tests/io/sas/data' | ||
files = {"sas7bdat": "test1.sas7bdat", "xport": "paxraw_d_short.xpt"} | ||
file = files[format] | ||
paths = [ | ||
os.path.dirname(__file__), | ||
"..", | ||
"..", | ||
"..", | ||
"pandas", | ||
"tests", | ||
"io", | ||
"sas", | ||
"data", | ||
file, | ||
] | ||
self.f = os.path.join(*paths) | ||
def time_read_sas7bdat_2(self): | ||
next(read_sas(ROOT / "0x00controlbyte.sas7bdat.bz2", chunksize=11000)) | ||
|
||
def time_read_sas(self, format): | ||
read_sas(self.f, format=format) | ||
def time_read_sas7bdat_2_chunked(self): | ||
for i, _ in enumerate( | ||
read_sas(ROOT / "0x00controlbyte.sas7bdat.bz2", chunksize=1000) | ||
): | ||
if i == 10: | ||
break |
Oops, something went wrong.