Improve performance of exporting variable-width strings to numpy StringDType

Open
#147 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
numpy, python, rust

Research direction

No file or test is named; start by tracing the current variable-width string export and reviewing the safe Rust-numpy APIs available for constructing StringDType arrays. Done means exporting the data without first copying it into a list of Python string objects, while preserving the existing result.

Written by the indexing model from the issue text.

Description

performance

The only way to create a string-typed numpy array from Python is from a list of Python string objects. This is very slow because you first need to copy your data into Python string objects.

(There are some low-level unsafe numpy C APIs, but I don't want to be mucking around manually in the numpy C API.)

We currently export variable-width string data first to a list of PyString and then to the numpy array constructor.

Hopefully the Rust-numpy crate will add safe APIs for passing a vector of String or &str to numpy from Rust.

Dominant language
Python
Stars
52
Forks
3
Avg merge
36m
Merged PRs (30d)
5

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from developmentseed/zarrista

All issues in developmentseed/zarrista

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.