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

perf(duckdb): speedup timestamp conversion by avoiding conversion to object #9556

Merged
merged 3 commits into from
Jul 13, 2024

Conversation

cpcloud
Copy link
Member

@cpcloud cpcloud commented Jul 12, 2024

Redo of #9554. The slow bit here was object conversion of timestamps, which seemed to only be hit by this one test.

@cpcloud cpcloud added performance Issues related to ibis's performance timestamps Issues related to the timestamp API duckdb The DuckDB backend labels Jul 12, 2024
@cpcloud cpcloud requested review from jcrist and gforsyth July 12, 2024 13:50
@cpcloud
Copy link
Member Author

cpcloud commented Jul 12, 2024

Still about 5x left that we're losing, but that can be done in a follow up.

@cpcloud cpcloud added this to the 9.2 milestone Jul 12, 2024
@cpcloud
Copy link
Member Author

cpcloud commented Jul 12, 2024

Ok found a few of the remaining Xs in a bug 🐞

@cpcloud
Copy link
Member Author

cpcloud commented Jul 12, 2024

Added a benchmark, which actually times out on main and on this branch is the same speed as DuckDB native.

@@ -200,8 +200,10 @@ def convert_Boolean(cls, s, dtype, pandas_type):

@classmethod
def convert_Timestamp(cls, s, dtype, pandas_type):
if isinstance(dtype, pd.DatetimeTZDtype):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check was always False, because dtype is always an Ibis type.

@cpcloud cpcloud force-pushed the duckdb-timestamp-perf branch 4 times, most recently from 7fdbba2 to 532c76e Compare July 12, 2024 14:46
Copy link
Member

@gforsyth gforsyth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, and I think the shift from ns to us precision is a non-issue here, since DuckDB doesn't support ns timestamps in the first-place, so it's mostly a very small change in the representation of the results, but the values aren't fundamentally changing.

@cpcloud cpcloud merged commit 5923e1e into ibis-project:main Jul 13, 2024
76 checks passed
@cpcloud cpcloud deleted the duckdb-timestamp-perf branch July 13, 2024 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duckdb The DuckDB backend performance Issues related to ibis's performance timestamps Issues related to the timestamp API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants