Skip to content

Conversation

@jbrockmendel
Copy link
Member

import numpy as np
import pandas as pd

arr = np.arange(5)
ser = pd.Series(arr)

%timeit pd.core.construction.extract_array(arr, extract_numpy=True)
924 ns ± 23.5 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)  # <- main
205 ns ± 15.6 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)  # <- PR

%timeit pd.core.construction.extract_array(ser, extract_numpy=True)
1.34 µs ± 20.8 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)  # <- main
471 ns ± 9.53 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)  # <- PR

@phofl phofl added the Performance Memory or execution speed performance label Apr 2, 2023
@phofl phofl added this to the 2.1 milestone Apr 2, 2023
@phofl phofl merged commit 91c2cb5 into pandas-dev:main Apr 2, 2023
@phofl
Copy link
Member

phofl commented Apr 2, 2023

thx @jbrockmendel

@jbrockmendel jbrockmendel deleted the perf-extract_array branch April 2, 2023 17:30
topper-123 pushed a commit to topper-123/pandas that referenced this pull request Apr 6, 2023
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants