Skip to content

Conversation

@jorisvandenbossche
Copy link
Member

Something small, but most of the time we will be setting with actual scalars, so putting that first improves this case a bit:

arr = pd.date_range("2012-01-01", periods=3).array scalar = arr[0] In [3]: %timeit arr._validate_setitem_value(scalar) 3.04 µs ± 58.5 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each) # <-- master 2.08 µs ± 27.2 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each) # <-- PR

(it gives a noticeable difference in eg fillna benchmarks)

@jorisvandenbossche jorisvandenbossche added the Performance Memory or execution speed performance label Nov 24, 2021
@jorisvandenbossche jorisvandenbossche added this to the 1.4 milestone Nov 24, 2021
@jorisvandenbossche
Copy link
Member Author

The second commits gives another small improvement (the _assert_tzawareness_compat just before already ensures that self and other have either both a tz or both not):

In [3]: %timeit arr._validate_setitem_value(scalar) 3.04 µs ± 58.5 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each) # <-- master 1.85 µs ± 82 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each) # <-- pR
Copy link
Member

@jbrockmendel jbrockmendel left a comment

Choose a reason for hiding this comment

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

LGTM

@jreback jreback merged commit 58a7698 into pandas-dev:master Nov 25, 2021
@jreback
Copy link
Contributor

jreback commented Nov 25, 2021

thanks. at some point if you can add the collected PR numbers to the whatsnew in the perf improvements section.

@jorisvandenbossche jorisvandenbossche deleted the perf-datetimelike-validate-scalar branch November 25, 2021 16:09
@jorisvandenbossche
Copy link
Member Author

@jreback they're mostly related to (or most relevant for) ArrayManager, so I should probably start with some actual basic docs about it before starting to mention it in the whatsnew

@jreback
Copy link
Contributor

jreback commented Nov 25, 2021

well u can certainly make a section in the whatsnew to indicate that perf for these have changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Performance Memory or execution speed performance

3 participants