Stop paying for the [TILEDBG] diagnostics when debug logging is off - #42
Merged
Conversation
_on_view_changed_internal reported the distinct-value counts of the
backend's raw native crop and of the sampled tile. Both are np.unique --
full sorts -- and both were passed as ARGUMENTS to _TLOG.debug. Lazy
%-formatting does not help there: arguments are evaluated before the call,
so EVERY pan and zoom paid for them at any log level.
Measured on a 4096^2 frame, where VIEW_OVERFETCH=2.0 makes the over-fetched
crop the whole image at any zoom below 2x:
np.unique(raw crop) 4096^2 259 ms
np.unique(raw crop) 2048^2 65 ms
np.unique(tile) 1024^2 12 ms
End to end, a pan settle goes 378 -> 78 ms at 1.1x-2x zoom and 125 -> 57 ms
at 4x. The counts are genuinely useful -- they catch a backend handing back
a downsample instead of native pixels -- so they move into
_log_fetch_diagnostic behind an isEnabledFor(DEBUG) guard rather than being
deleted. _refresh_overview's min/max got the same treatment.
test_tile_diagnostics.py pins the guard (not the message text) from both
sides: no sorting at INFO, the FETCH line still emitted at DEBUG, and the
displayed tile identical either way.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #42 +/- ##
==========================================
- Coverage 90.41% 90.35% -0.07%
==========================================
Files 39 39
Lines 4008 4014 +6
==========================================
+ Hits 3624 3627 +3
- Misses 384 387 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
_on_view_changed_internalreported the distinct-value counts of the backend's raw native crop and of the sampled tile. Both arenp.unique— full sorts — and both were passed as arguments to_TLOG.debug. Lazy%-formatting does not help there: arguments are evaluated before the call, so every pan and zoom paid for them at any log level.Measured on a 4096² frame.
VIEW_OVERFETCH = 2.0makes the over-fetched crop the whole image at any zoom below 2×, which is where panning actually happens:np.unique(raw crop)np.unique(raw crop)np.unique(raw crop)np.unique(tile)End to end, a pan settle on a 4096² frame:
The counts are genuinely useful — they catch a backend handing back a downsample instead of native pixels — so they move into
_log_fetch_diagnosticbehind anisEnabledFor(DEBUG)guard rather than being deleted._refresh_overview'smin/maxgot the same treatment.test_tile_diagnostics.pypins the guard rather than the message text, from both sides: no sorting at INFO, the FETCH line still emitted at DEBUG, and the displayed tile byte-identical either way.Found while chasing slow panning on a 4k in-situ movie in SpyDE. SpyDE needs this released as 0.4.2 before it can bump its
anyplotlib>=pin.Full
test_plot2dsuite passes (305 + 3 new).