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: regression in DataFrame construction from nested dict #42248

Closed
jorisvandenbossche opened this issue Jun 26, 2021 · 1 comment · Fixed by #42338
Closed

PERF: regression in DataFrame construction from nested dict #42248

jorisvandenbossche opened this issue Jun 26, 2021 · 1 comment · Fixed by #42338
Labels
Constructors Series/DataFrame/Index/pd.array Constructors Performance Memory or execution speed performance Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Jun 26, 2021

#41785 removed some cython code to handle this case (because it could also be handled by existing python code, AFAIU), but this de-duplication caused a big slowdown in one of the benchmarks: https://pandas.pydata.org/speed/pandas/#frame_ctor.FromDicts.time_nested_dict_int64?python=3.8&Cython=0.29.21

It's of course a trade-off between the maintenance cost of having the cython version versus the performance benefit. But if the benchmark is representative, a 5-6x slowdown seems quite a lot for getting rid of a relatively small piece of cython code.

Originally posted by @jorisvandenbossche in #41785 (comment)

@jorisvandenbossche jorisvandenbossche added Constructors Series/DataFrame/Index/pd.array Constructors Performance Memory or execution speed performance Regression Functionality that used to work in a prior pandas version labels Jun 26, 2021
@jorisvandenbossche jorisvandenbossche added this to the 1.3 milestone Jun 26, 2021
@jbrockmendel
Copy link
Member

can you verify this?

This appears correct. For context, this change was made as a follow-up to a bugfix where this de-duplication would have prevented the bug. I agree 5-6x is a bigger slowdown than I expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Constructors Series/DataFrame/Index/pd.array Constructors Performance Memory or execution speed performance Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants