Skip to content

Commit d4ef11c

Browse files
Copilotshai-almog
andauthored
Replace hardcoded Base64 in Simd with generic primitives; rewrite Base64 SIMD in Java (#4745)
* Add NEON-accelerated base64Encode/base64Decode to Simd API and wire into Base64 SIMD methods Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/c218992e-943a-4ce5-8d63-f82c0792416f Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Address code review: clarify loop conditions and comment in NEON base64 Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/c218992e-943a-4ce5-8d63-f82c0792416f Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Add new SIMD generic primitive declarations and remove base64 methods from IOSSimd - Added shl, shrLogical, addWrapping, subWrapping for byte arrays - Added offset-based overloads for unpackUnsignedByteToInt, add, cmpEq, cmpLt, select - Removed base64Encode and base64Decode declarations Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Replace base64 overrides with generic SIMD primitive validation wrappers in JavaSESimd Remove base64Encode and base64Decode overrides. Add validation wrapper overrides for new generic Simd primitives: shl, shrLogical, addWrapping, subWrapping, unpackUnsignedByteToInt, add (int[]), cmpEq, cmpLt, and select. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Replace base64 NEON section with generic SIMD primitives in IOSSimd.m Remove NEON-accelerated Base64 encode/decode implementations and add NEON implementations for new generic Simd primitives: shl, shrLogical, addWrapping, subWrapping, unpackUnsignedByteToInt, add (int), cmpEq, cmpLt, and select (with offset parameters). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Remove base64 methods from Simd; add generic byte/int primitives; rewrite Base64 SIMD in Java - Remove base64Encode/base64Decode from Simd, IOSSimd, JavaSESimd, IOSSimd.m - Add generic byte shift primitives: shl(byte[]), shrLogical(byte[]) - Add wrapping byte arithmetic: addWrapping(byte[]), subWrapping(byte[]) - Add offset-based int overloads: unpackUnsignedByteToInt, add, cmpLt, cmpEq, select - Add NEON implementations for all new primitives in IOSSimd.m - Add validation wrappers in JavaSESimd.java - Rewrite encodeNoNewlineSimd in Java using int-domain SIMD compare/select - Rewrite decodeNoWhitespaceSimd in Java using int-domain SIMD shift/or - Update SimdTest with tests for new primitives - All 2345 tests pass Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/5fc6976c-f0ec-4638-b22b-2cbc9c9ca5dd Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Optimize SIMD Base64: replace slow scatter/gather + per-element SIMD calls with fast inline scalar Java The previous approach called 15+ individual Simd operations per 48-byte chunk (each a virtual dispatch + JNI transition on iOS), plus scalar scatter/gather loops for byte↔int conversion. This added ~2500 JNI transitions per encode of 8KB, making it 64-109% slower than the already-fast scalar code. Replace with the same 4x-unrolled table-lookup approach used by encodeNoNewline(), now with offset support. This matches the scalar CN1 encode/decode performance while maintaining the same API contract. Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/90b8c36e-8f20-47da-9fb4-56344f18a336 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com> * Revert "Optimize SIMD Base64: replace slow scatter/gather + per-element SIMD calls with fast inline scalar Java" This reverts commit 00e5103. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com>
1 parent 5493419 commit d4ef11c

File tree

6 files changed

+701
-133
lines changed

6 files changed

+701
-133
lines changed

0 commit comments

Comments
 (0)