Repository navigation
perf: bulk getRGB in binarisation — 35% faster, identical output - #3
Merged
Merged
Conversation
…in DistanceImageBinarizer
The README said the output CSV has "one row per second". It has one row per decoded frame — a 478-second clip produces 11,477 rows, about 24 per second — and the sample rows showed integer timestamps where real output is fractional. Pre-existing; carried over from the original README. Also documents the bulk-getRGB change measured on that clip: 4m48s to 3m06s, 35% faster, byte-for-byte identical output.
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.
Recovers a commit that was sitting unmerged on the stale
performancebranch,35 commits behind
main, since 2026-06-02.The change
DistanceImageBinarizerread each frame withgetRGB(x, y)inside a nestedloop. Per-pixel access goes through the
BufferedImagecolour model on everycall, and this runs for every pixel of every frame of every video — it is the
hot path. Replaced with a single bulk
getRGB(0, 0, width, height, …)into anint[].DfsBinaryGroupFinder.adjacentPixelsis inlined in the same commit.Measured
Full CLI run over
videos/ensantina.mp4— 478 seconds of footage, 11,477frames:
main)Output CSV is byte-for-byte identical between the two runs — same 11,477
rows, verified with
diff. Full unit suite passes.Also in this PR
While benchmarking I found the README claims the CSV has "one row per second".
It has one row per decoded frame — 11,477 rows over 478 seconds, roughly 24 per
second — and the sample rows showed integer timestamps where real output is
fractional. That was carried over from the original README. Corrected, and the
speedup above is now recorded in the architecture section.
The stale
performancebranch can be deleted once this merges.