Conversation
- Increase input and decompression buffers to 16KB to reduce JNI overhead. - Remove unused outputBuf property. - Implement readCpixel fast-path for direct 3-byte reads from internal buffer. - Refactor RLE decoding loops to use Arrays.fill and avoid division/modulo. Co-authored-by: kimocoder <4252297+kimocoder@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
Optimizes the ZRLE (RFB encoding 16) decoding hot path to reduce per-pixel overhead during VNC/X11 framebuffer updates.
Changes:
- Increased zlib input/output buffering to 16KB and removed an unused buffer field.
- Optimized Solid / Plain RLE / Palette RLE tile decoding by replacing per-pixel loops (and div/mod) with span fills and manual coordinate tracking.
- Added a fast-path in
readCpixel()to read 3 bytes directly when already buffered.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| app/src/main/java/com/excp/podroid/x11/ZrleDecoder.kt | Performance-focused refactor: larger buffers, Arrays.fill spans, div/mod elimination, and CPIXEL fast-path. |
| .jules/bolt.md | Documents the performance learnings and standardization goal behind the optimization approach. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private inner class ZInput(private val inf: Inflater) { | ||
| private val buf = ByteArray(256) | ||
| private val buf = ByteArray(16384) | ||
| private var pos = 0 |
| // Scratch buffer for compressed input read from the socket. | ||
| private var inputScratch = ByteArray(4096) | ||
| // Decompressed output buffer; re-used across inflate calls within one decode() call. | ||
| private var outputBuf = ByteArray(4096) | ||
| private var inputScratch = ByteArray(16384) | ||
|
|
💡 What:
inputScratchandZInput.bufto 16KB to minimize JNI transition overhead during zlib decompression.outputBufproperty.readCpixel()that reads 3 bytes directly from the buffer when available, bypassing redundant checks.java.util.Arrays.fillfor horizontal pixel spans and replaced coordinate arithmetic (division/modulo) with manual tracking.🎯 Why:
Arrays.filltypically maps to optimized nativememsetor SIMD instructions, which are much faster than per-pixel manual assignment.📊 Impact:
🔬 Measurement:
./gradlew :app:testDebugUnitTest --tests "com.excp.podroid.x11.ZrleDecoderTest".PR created automatically by Jules for task 2593770975122726470 started by @kimocoder