Skip to content

Conversation

@kylebarron
Copy link
Member

@kylebarron kylebarron commented Oct 30, 2025

What's happening here is that _repr_mimebundle_ creates both the rich HTML content and a plain text repr to show in environments that don't support HTML rendering.

So it was taking 11.6 seconds to print the string repr of the Arrow table, just to generate the _repr_mimebundle_.

I'm not clear if this is a regression or just an unhandled bug on the arro3 side (kylebarron/arro3#432). I think arro3 handles long tables by taking the first and last n rows to print. But it clearly doesn't handle very wide rows at all.

Change list

  • This overrides _repr_keys to ensure that the str repr of the table attribute is never generated. I think this is the only key that should be very slow.

Benchmark

99.9% faster rendering 😅

On this branch:

from lonboard import viz
from geodatasets import get_path
import geopandas as gpd
from IPython.display import display

gdf = gpd.read_file(get_path("nybb"))

%%time
m = viz(gdf)
# CPU times: user 112 ms, sys: 28.3 ms, total: 141 ms
# Wall time: 148 ms

%%time
display(m)
# CPU times: user 5.01 ms, sys: 1.41 ms, total: 6.43 ms
# Wall time: 5.64 ms

On main:

from lonboard import viz
from geodatasets import get_path
import geopandas as gpd
from IPython.display import display

gdf = gpd.read_file(get_path("nybb"))

%%time
m = viz(gdf)
# CPU times: user 112 ms, sys: 28.3 ms, total: 141 ms
# Wall time: 148 ms

%%time
display(m)
# CPU times: user 11.6 s, sys: 262 ms, total: 11.9 s
# Wall time: 12 s

Closes #1014

@github-actions github-actions bot added the perf label Oct 30, 2025
@kylebarron kylebarron merged commit 8690882 into main Oct 30, 2025
10 checks passed
@kylebarron kylebarron deleted the kyle/perf-slow-table-repr branch October 30, 2025 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Very slow performance when rendering Map with polygon layer

2 participants