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: halve render time in Styler with itertuples #39972

Merged
merged 2 commits into from
Feb 23, 2021

Conversation

attack68
Copy link
Contributor

@attack68 attack68 commented Feb 22, 2021

 before           after         ratio
     [dfb92d0f]       [e5c2790b]
     <master>         <perf_itertups>
-         149±1ms         74.4±2ms     0.50  io.style.RenderApply.time_render(24, 120)
-        31.9±1ms       15.9±0.8ms     0.50  io.style.RenderApply.time_render(24, 12)
-       86.3±20ms         42.3±1ms     0.49  io.style.RenderApply.time_render(12, 120)
-      12.2±0.2ms       5.93±0.2ms     0.49  io.style.RenderApply.time_render(12, 12)
-      44.8±0.5ms       21.7±0.3ms     0.48  io.style.RenderApply.time_render(36, 12)
-         227±2ms         99.9±1ms     0.44  io.style.RenderApply.time_render(36, 120)

SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY.
PERFORMANCE INCREASED.

FYI Styler now faster than to_html, even without any function stripping...

df = pd.DataFrame(np.random.rand(10000,10))
%timeit df.to_html()
1.9 s ± 63.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
%timeit df.style.render()
1.71 s ± 14.2 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

@jreback jreback added the Styler conditional formatting using DataFrame.style label Feb 22, 2021
@jreback jreback added this to the 1.3 milestone Feb 22, 2021
@jreback
Copy link
Contributor

jreback commented Feb 22, 2021

great. Can you add a whatsnew note (IIRC you may already have one about perf rendering, if so just add this on). ping on greenish.

@attack68
Copy link
Contributor Author

@jreback ping greenish. test_from_coo failure is unrelated.

@jreback jreback merged commit 8425e04 into pandas-dev:master Feb 23, 2021
@jreback
Copy link
Contributor

jreback commented Feb 23, 2021

thanks @attack68

@attack68 attack68 deleted the perf_itertups branch February 23, 2021 16:54
@attack68 attack68 added the Performance Memory or execution speed performance label Mar 30, 2021
@attack68 attack68 mentioned this pull request Jun 1, 2021
1 task
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 Styler conditional formatting using DataFrame.style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants