Skip to content

Revert "perf: SIMD-accelerated FastBase64 for Scala Native via C FFI"#777

Merged
stephenamar-db merged 1 commit intomasterfrom
revert-749-perf/fast-base64-native
Apr 14, 2026
Merged

Revert "perf: SIMD-accelerated FastBase64 for Scala Native via C FFI"#777
stephenamar-db merged 1 commit intomasterfrom
revert-749-perf/fast-base64-native

Conversation

@stephenamar-db
Copy link
Copy Markdown
Collaborator

Reverts #749

@stephenamar-db stephenamar-db merged commit 4123ac3 into master Apr 14, 2026
5 checks passed
@stephenamar-db stephenamar-db deleted the revert-749-perf/fast-base64-native branch April 14, 2026 16:20
He-Pin added a commit to He-Pin/sjsonnet that referenced this pull request Apr 14, 2026
Motivation:
PR databricks#749 added SIMD base64 and runtime optimizations (ByteArr, RangeArr,
asciiSafe) but was reverted by databricks#777 due to incorrect hand-written x86
SIMD C code. This PR restores all optimizations while replacing the
buggy SIMD code with the battle-tested aklomp/base64 library.

Modification:
- Replace hand-written C SIMD with aklomp/base64 (BSD-2-Clause) which
  provides correct SIMD dispatch (SSSE3/AVX2/AVX512/NEON64) via runtime
  CPU detection
- Add PlatformBase64 abstraction: JVM/JS use java.util.Base64 with strict
  RFC 4648 padding validation, Native uses aklomp/base64 FFI
- Switch to strict mode aligned with go-jsonnet: reject unpadded base64
  input (e.g. "YQ" without "=="). java.util.Base64 is lenient, so JVM/JS
  add explicit length check for ASCII input, matching go-jsonnet's
  len(str) % 4 != 0 check (builtins.go:1467)
- Restore Val.ByteArr: compact byte-backed array for base64DecodeBytes
- Restore Val.RangeArr subclass from flag-based _isRange
- Restore Val.Str._asciiSafe + renderAsciiSafeString
- Restore Materializer/ByteRenderer fast paths for ByteArr
- Add comprehensive test suite (56+ Scala tests + 4 Jsonnet golden tests)

Result:
Beats jrsonnet on DecodeBytes benchmarks (1.47x faster). Overall 15-38%
faster than master on base64 workloads.
He-Pin added a commit to He-Pin/sjsonnet that referenced this pull request Apr 18, 2026
Motivation:
PR databricks#749 added SIMD base64 and runtime optimizations (ByteArr, RangeArr,
asciiSafe) but was reverted by databricks#777 due to incorrect hand-written x86
SIMD C code. This PR restores all optimizations while replacing the
buggy SIMD code with the battle-tested aklomp/base64 library.

Modification:
- Replace hand-written C SIMD with aklomp/base64 (BSD-2-Clause) which
  provides correct SIMD dispatch (SSSE3/AVX2/AVX512/NEON64) via runtime
  CPU detection
- Add PlatformBase64 abstraction: JVM/JS use java.util.Base64 with strict
  RFC 4648 padding validation, Native uses aklomp/base64 FFI
- Switch to strict mode aligned with go-jsonnet: reject unpadded base64
  input (e.g. "YQ" without "=="). java.util.Base64 is lenient, so JVM/JS
  add explicit length check for ASCII input, matching go-jsonnet's
  len(str) % 4 != 0 check (builtins.go:1467)
- Restore Val.ByteArr: compact byte-backed array for base64DecodeBytes
- Restore Val.RangeArr subclass from flag-based _isRange
- Restore Val.Str._asciiSafe + renderAsciiSafeString
- Restore Materializer/ByteRenderer fast paths for ByteArr
- Add comprehensive test suite (56+ Scala tests + 4 Jsonnet golden tests)

Result:
Beats jrsonnet on DecodeBytes benchmarks (1.47x faster). Overall 15-38%
faster than master on base64 workloads.
He-Pin added a commit to He-Pin/sjsonnet that referenced this pull request Apr 18, 2026
Motivation:
PR databricks#749 added SIMD base64 and runtime optimizations (ByteArr, RangeArr,
asciiSafe) but was reverted by databricks#777 due to incorrect hand-written x86
SIMD C code. This PR restores all optimizations while replacing the
buggy SIMD code with the battle-tested aklomp/base64 library.

Modification:
- Replace hand-written C SIMD with aklomp/base64 (BSD-2-Clause) which
  provides correct SIMD dispatch (SSSE3/AVX2/AVX512/NEON64) via runtime
  CPU detection
- Add PlatformBase64 abstraction: JVM/JS use java.util.Base64 with strict
  RFC 4648 padding validation, Native uses aklomp/base64 FFI
- Switch to strict mode aligned with go-jsonnet: reject unpadded base64
  input (e.g. "YQ" without "=="). java.util.Base64 is lenient, so JVM/JS
  add explicit length check for ASCII input, matching go-jsonnet's
  len(str) % 4 != 0 check (builtins.go:1467)
- Restore Val.ByteArr: compact byte-backed array for base64DecodeBytes
- Restore Val.RangeArr subclass from flag-based _isRange
- Restore Val.Str._asciiSafe + renderAsciiSafeString
- Restore Materializer/ByteRenderer fast paths for ByteArr
- Add comprehensive test suite (56+ Scala tests + 4 Jsonnet golden tests)

Result:
Beats jrsonnet on DecodeBytes benchmarks (1.47x faster). Overall 15-38%
faster than master on base64 workloads.
He-Pin added a commit to He-Pin/sjsonnet that referenced this pull request Apr 21, 2026
Motivation:
PR databricks#749 added SIMD base64 and runtime optimizations (ByteArr, RangeArr,
asciiSafe) but was reverted by databricks#777 due to incorrect hand-written x86
SIMD C code. This PR restores all optimizations while replacing the
buggy SIMD code with the battle-tested aklomp/base64 library.

Modification:
- Replace hand-written C SIMD with aklomp/base64 (BSD-2-Clause) which
  provides correct SIMD dispatch (SSSE3/AVX2/AVX512/NEON64) via runtime
  CPU detection
- Add PlatformBase64 abstraction: JVM/JS use java.util.Base64 with strict
  RFC 4648 padding validation, Native uses aklomp/base64 FFI
- Switch to strict mode aligned with go-jsonnet: reject unpadded base64
  input (e.g. "YQ" without "=="). java.util.Base64 is lenient, so JVM/JS
  add explicit length check for ASCII input, matching go-jsonnet's
  len(str) % 4 != 0 check (builtins.go:1467)
- Restore Val.ByteArr: compact byte-backed array for base64DecodeBytes
- Restore Val.RangeArr subclass from flag-based _isRange
- Restore Val.Str._asciiSafe + renderAsciiSafeString
- Restore Materializer/ByteRenderer fast paths for ByteArr
- Add comprehensive test suite (56+ Scala tests + 4 Jsonnet golden tests)

Result:
Beats jrsonnet on DecodeBytes benchmarks (1.47x faster). Overall 15-38%
faster than master on base64 workloads.
He-Pin added a commit to He-Pin/sjsonnet that referenced this pull request Apr 21, 2026
Motivation:
PR databricks#749 added SIMD base64 and runtime optimizations (ByteArr, RangeArr,
asciiSafe) but was reverted by databricks#777 due to incorrect hand-written x86
SIMD C code. This PR restores all optimizations while replacing the
buggy SIMD code with the battle-tested aklomp/base64 library.

Modification:
- Replace hand-written C SIMD with aklomp/base64 (BSD-2-Clause) which
  provides correct SIMD dispatch (SSSE3/AVX2/AVX512/NEON64) via runtime
  CPU detection
- Add PlatformBase64 abstraction: JVM/JS use java.util.Base64 with strict
  RFC 4648 padding validation, Native uses aklomp/base64 FFI
- Switch to strict mode aligned with go-jsonnet: reject unpadded base64
  input (e.g. "YQ" without "=="). java.util.Base64 is lenient, so JVM/JS
  add explicit length check for ASCII input, matching go-jsonnet's
  len(str) % 4 != 0 check (builtins.go:1467)
- Restore Val.ByteArr: compact byte-backed array for base64DecodeBytes
- Restore Val.RangeArr subclass from flag-based _isRange
- Restore Val.Str._asciiSafe + renderAsciiSafeString
- Restore Materializer/ByteRenderer fast paths for ByteArr
- Add comprehensive test suite (56+ Scala tests + 4 Jsonnet golden tests)

Result:
Beats jrsonnet on DecodeBytes benchmarks (1.47x faster). Overall 15-38%
faster than master on base64 workloads.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant