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

Refactor schema #2788

Merged
merged 2 commits into from
Feb 27, 2022
Merged

Refactor schema #2788

merged 2 commits into from
Feb 27, 2022

Conversation

ritchie46
Copy link
Member

Every node in a lazy computation gets a schema. Evaluating an expression requires several schema lookups. This was backed by a Vec. But the data in the schema is &str so there is a lot of indirection and thus cache misses. Besides that the usage of polars with regards of number of expressions ran on a DataFrame and number of columns that are stored in a DataFrame far exceed my initial exprectations/ guesses. Both are in the millions, meaning we need O(1) instead of O(n) schema lookups.

This PR refactors the schema to be backed by IndexMap. This is a hashmap that also stores insertion order.

@ghuls FYI

@ritchie46 ritchie46 merged commit 05f7db1 into master Feb 27, 2022
@ritchie46 ritchie46 deleted the refactor_schema branch February 27, 2022 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant