Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance regression when reading scoring files during matching #20

Closed
nebfield opened this issue May 29, 2024 · 0 comments · Fixed by #22
Closed

Performance regression when reading scoring files during matching #20

nebfield opened this issue May 29, 2024 · 0 comments · Fixed by #22
Labels
bug Something isn't working

Comments

@nebfield
Copy link
Member

def loose(record_batches, schema, tmpdir=None):
"""Loose an arrow :) Stream compressed text files into temporary arrow files
polars + arrow = very fast reading and processing
"""
if tmpdir is None:
tmpdir = tempfile.mkdtemp()
arrowpath = tempfile.NamedTemporaryFile(dir=tmpdir, delete=False)
with pa.OSFile(arrowpath.name, "wb") as sink:
with pa.RecordBatchFileWriter(sink=sink, schema=schema) as writer:
for batch in record_batches:
writer.write(batch)
return arrowpath

We used to parse CSV files with polars and save IPC files, it's super fast 🚀

Streaming pyarrow batches is terribly slow in comparison (when working on UK Biobank). I think i was worried about memory usage when I wrote this.

This might also drop the pyarrow dependency in pgscatalog.core

@nebfield nebfield added the bug Something isn't working label May 29, 2024
@nebfield nebfield linked a pull request Jun 2, 2024 that will close this issue
@smlmbrt smlmbrt closed this as completed Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants