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: DatetimeIndex constructor from list #48609

Merged

Conversation

lukemanley
Copy link
Member

@lukemanley lukemanley commented Sep 17, 2022

Improvement comes from avoiding np.ndim on a large list of objects.

ASVs added:

     [ac648eea]       [5e8af646]
     <main>           <perf-ensure-arraylike-for-datetimelike>
-      41.7±0.6ms         30.1±1ms     0.72  ctors.DatetimeIndexConstructor.time_from_list_of_str
-        239±20ms          110±1ms     0.46  ctors.DatetimeIndexConstructor.time_from_list_of_datetimes
-         243±3ms        111±0.6ms     0.46  ctors.DatetimeIndexConstructor.time_from_list_of_timestamps
-         242±5ms          108±1ms     0.45  ctors.DatetimeIndexConstructor.time_from_list_of_dates

@phofl
Copy link
Member

phofl commented Sep 17, 2022

A general note: I think our rule of thumb regarding benchmarks is: Around 20ms.

@lukemanley
Copy link
Member Author

Sorry, I should have remembered. I just updated the asv to reduce the time:

       before           after         ratio
     [a712c501]       [a572dc1e]
     <main>           <perf-ensure-arraylike-for-datetimelike>
-     7.47±0.07ms      5.42±0.09ms     0.72  ctors.DatetimeIndexConstructor.time_from_list_of_str
-      44.0±0.4ms       20.5±0.4ms     0.47  ctors.DatetimeIndexConstructor.time_from_list_of_datetimes
-      43.6±0.2ms       19.9±0.2ms     0.46  ctors.DatetimeIndexConstructor.time_from_list_of_timestamps
-      42.9±0.6ms       19.4±0.2ms     0.45  ctors.DatetimeIndexConstructor.time_from_list_of_dates

@phofl
Copy link
Member

phofl commented Sep 17, 2022

Thx, no worries

@mroeschke mroeschke added Datetime Datetime data dtype Performance Memory or execution speed performance labels Sep 19, 2022
@mroeschke mroeschke added this to the 1.6 milestone Sep 19, 2022
Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

LGTM. Merge when ready @phofl

@phofl phofl merged commit c68a96f into pandas-dev:main Sep 20, 2022
@phofl
Copy link
Member

phofl commented Sep 20, 2022

thx @lukemanley

@lukemanley lukemanley deleted the perf-ensure-arraylike-for-datetimelike branch September 24, 2022 00:48
@mroeschke mroeschke modified the milestones: 1.6, 2.0 Oct 13, 2022
noatamir pushed a commit to noatamir/pandas that referenced this pull request Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants