Repository navigation
Conversation
`compile_components` is memoized on the full schema and glyph, so the same `append` source is generated for many inputs, e.g. when unused columns or column names differ. Each one became a new numba dispatcher, and since the glyphs memoize their kernels on the `append` object, the whole kernel chain was compiled again. Caching the jitted `append` on its code and globals lets numba and the glyphs reuse their compilations. Assisted-by: Claude Code:claude-opus-5-5
hoxbro
added this pull request to stack #1541
October 14, 2026 12:52
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1540 +/- ##
==========================================
+ Coverage 88.50% 88.70% +0.19%
==========================================
Files 96 96
Lines 19536 19545 +9
==========================================
+ Hits 17291 17338 +47
+ Misses 2245 2207 -38 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The glyphs memoize their compiled kernels on `info` and the antialias stage 2 functions. Both were new objects for every `compile_components` cache miss, e.g. when unused columns or their dtypes differ, so the glyph kernels were compiled again. Memoizing them on their hashable inputs lets the glyphs reuse their kernels. Assisted-by: Claude Code:claude-opus-5-5
append functions with identical generated codecompile_components cache misses
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
compile_componentsis memoized on the full schema and glyph, so a frame with different unused columns, dtypes or column names misses the cache and builds new functions, even when they are identical to ones already built. The glyphs memoize their kernels (extend_cpu,draw_segment,_bresenham, ...) on these functions, so the whole kernel chain is compiled again. The compiled code is never freed, so memory grows over the test suite.This reuses the functions when their inputs are the same:
append, whichmake_appendbuilds from a source string withexec, is cached on its generated code and the globals it is executed with.make_infoandmake_antialias_stage_2_functionsare memoized. They returned a newinfoclosure and new antialias stage 2 functions on every cache miss, and the glyphs' memoized_build_extendtakes both as arguments.This came up while investigating the ubuntu unit jobs on #1539 being killed after hanging, where each of the 4 xdist workers ends at ~4.4 GB RSS (~17.5 GB total on a 16 GB runner). On
main, the workers already end at ~3.5–3.7 GB each.appendcache, measured on the #1539 branch (which also passes columns to numba as read-only arrays), running the masked/dict/arrow tests in one process:appendfunctions built (unique)make_infoandmake_antialias_stage_2_functionsmemoization, measured on this branch withtest_pandas.pyin one process:The remaining duplicates mostly come from glyph kernels memoized on the glyph itself, so different column names still compile them again. That is left for a follow-up.
Scripts
Counts
appendfunctions built vs. unique code + globals (-p append_plugin):Records RSS, numba dispatchers and compiled overloads after each test (
-p jit_plugin):Run with:
AI Disclosure
Tool & Model: Claude Code + Opus 5.5
Usage: Investigated the CI memory growth, wrote the change and the measurement scripts.
Checklist