Skip to content
CAI
Software that uses CAICheck a score

databricks/sjsonnet

49.5

Weak · 6 November 2026

27.7k

lines of production code

Scala

with JavaScript

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Sjsonnet is a high-performance, multi-platform implementation of the Jsonnet template language, supporting JVM, Scala.js, and Scala Native targets. It provides a robust engine for parsing, optimizing, and evaluating Jsonnet code, featuring a persistent server mode for efficient client-server communication and a browser-based playground for interactive development. The system includes comprehensive standard library functions for data manipulation, compression, and encoding, alongside extensive benchmarking and testing infrastructure to ensure correctness and performance across diverse environments.

How it got here

2018–2019 — sjsonnet architecture and platform expansion

12 changes.

This period focused on modernizing the sjsonnet codebase by replacing legacy build tools and shell-based test suites with a Mill-based infrastructure and comprehensive Scala unit tests. Significant features were added to support new execution modes, including a persistent background server, a Scala.js browser implementation, and optimized byte-oriented JSON rendering. The work also expanded standard library capabilities with compression, regex, and robust YAML parsing, while ensuring stability through rigorous concurrency and performance testing.

2020–2025 — Scala Native support and performance optimization

23 changes.

This period focused on expanding sjsonnet's platform support by introducing initial Scala Native capabilities and a Java BitSet compatibility layer for JavaScript and Native targets. Significant engineering effort was dedicated to performance optimization, including memory-efficient file caching, SIMD-accelerated base64 encoding, and the addition of comprehensive JMH benchmarks to profile the engine. The work also involved restructuring the standard library into submodules and implementing robust test coverage across JVM, Native, and GraalVM environments to ensure stability and correctness.

2026 — Performance optimization and playground release

8 changes.

This period focused on resolving critical performance regressions in JSON merging and recursive array operations while introducing SIMD-accelerated base64 encoding. The team also delivered a new browser-based Sjsonnet Playground for interactive evaluation and expanded test coverage with golden output automation and end-to-end integration tests.

Features

Add Java BitSet compatibility layer for JavaScript and Native targets

A Java-compatible BitSet implementation is now available for Scala.js and Scala Native platforms. This addition provides the necessary java.util.BitSet class, allowing code that depends on this standard Java collection to compile and function correctly on these non-JVM targets.

sjsonnet/src-js/java, sjsonnet/src-native/java · high confidence

Added C++ benchmark suite resources

Added a new set of benchmark resource files (bench.01 through bench.04) in the \bench/resources/cpp\_suite\ directory. These files define Jsonnet-based performance tests, including recursive sum, Fibonacci calculation, and string folding operations, along with their corresponding golden output files to verify correctness.

_bench/resources/cpp\suite · high confidence

Added XZ compression and optimized Base64 encoding

The stdlib now includes a new XZ compression function (NativeXz) that allows encoding strings or arrays with an optional compression level. Additionally, Base64 encoding performance is improved on the JVM by introducing a platform-specific implementation (PlatformBase64) that uses ISO-8859-1 encoding for ASCII-safe inputs, avoiding the overhead of UTF-8 conversion.

sjsonnet/src-jvm/sjsonnet/stdlib · high confidence

Added benchmark resource documentation and golden output refresh script

The bench/resources directory now includes a README explaining the structure of the benchmark suites (bug\_suite, cpp\_suite, go\_suite, and sjsonnet\_suite) and a new shell script to regenerate golden output files. This script ensures that golden outputs are refreshed using the same Scala version configured for the benchmark build, preventing drift between the runtime environment and the expected test results.

bench/resources · high confidence

Initial Scala Native support for sjsonnet

sjsonnet now runs on Scala Native, enabling users to execute Jsonnet code without a JVM. This platform-specific implementation includes a high-performance SWAR-based character scanner for efficient string escaping and ASCII safety checks, a buffered native output stream to reduce system call overhead, and a dedicated platform module that provides YAML parsing (including handling of non-finite floats and octals), gzip compression, and regex support via RE2. The native entry point wires these components together, making the library available as a standalone binary.

sjsonnet/src-native/sjsonnet · high confidence

Introduce Scala.js platform implementation for sjsonnet

Adds the \Platform.scala\ and \CharSWAR.scala\ files required to run sjsonnet on Scala.js. This implementation provides the necessary runtime abstractions for the JavaScript environment, including a single-threaded parse cache using \HashMap\ (since \TrieMap\ does not link in Scala.js), character scanning logic for JSON escaping, and the \parseYaml()\ function integration via the \org.virtuslab.yaml\ library. This enables users to evaluate Jsonnet templates in browser or Node.js contexts.

sjsonnet/src-js/sjsonnet · high confidence

Introduce Sjsonnet Playground for interactive Jsonnet evaluation

A new browser-based playground has been added to the \playground\ directory, providing a single-file, client-side IDE for writing, evaluating, and debugging Jsonnet code. The application (\playground/index.html\) bundles the Sjsonnet engine (compiled via Scala.js) and CodeMirror 5 for editing, supporting multi-file projects with import resolution, external variables, and top-level arguments. Users can toggle between dark and light themes, resize panels, and save/load their work via the browser's local storage or file downloads.

playground · high confidence

Introduce persistent background server mode for Sjsonnet

The sjsonnet/server module now includes a new \SjsonnetServerMain\ implementation that runs Sjsonnet as a persistent background daemon. This server listens for client connections via Unix domain sockets, reuses a \DefaultParseCache\ across invocations to improve performance, and handles client-server version mismatches by automatically restarting. It also disables SIGINT signals to prevent accidental termination when clients are interrupted, ensuring the long-running process remains stable.

sjsonnet/server · high confidence

New byte-oriented JSON renderer and performance profiling infrastructure

The sjsonnet library introduces a new \ByteRenderer\ that writes JSON output directly to an \OutputStream\ as bytes, bypassing the previous \BaseCharRenderer\ and \OutputStreamWriter\ UTF-8 encoding pipeline to reduce memory allocations and improve rendering throughput. This change also adds a \--debug-stats\ mode that exposes runtime performance counters—such as function calls, stack depth, and parse/eval times—via the \DebugStats\ class, and includes a re-implemented \DecimalFormat\ to ensure consistent number formatting across Scala.js and JVM targets.

sjsonnet/src/sjsonnet · high confidence

New client-side locking and async import infrastructure for sjsonnet

The repository introduces a new Java-based locking mechanism (Locks.java) to manage process, server, and client file locks, alongside a ProxyOutputStream for handling key-prefixed output streams. For the Scala.js target, a new SjsonnetMain.scala provides an async import loader that pre-loads all reachable imports before evaluation, enabling synchronous execution in the browser. The JVM-native entry point (SjsonnetMainBase.scala) is refactored to support these changes and exposes a comprehensive Config case class for CLI argument parsing, including new flags for YAML streaming, profiling, and strict format validation.

repository · high confidence

New compression and regex functions plus improved YAML parsing

Users can now use std.gzip, std.xz, and std.regex (via RE2) in their Jsonnet code, and YAML parsing is more robust with fixes for clip-chomped block scalars, non-finite floats, and cyclic aliases.

sjsonnet/src-jvm/sjsonnet · high confidence

Removals

Removal of legacy regression test suite

The \test\_suite\ directory has been removed, eliminating the legacy Bash-based regression tests (including \CMakeLists.txt\, \run\_tests.sh\, and hundreds of \.jsonnet\ and \.golden\ files). This change stops the execution of these specific validation scripts, which previously tested features such as float arithmetic, array operations, and various parse/runtime error conditions.

_test\suite · high confidence

Removal of legacy shell-based command-line test suite

The \test\_cmd\ directory's manual bash test harness (\run\_cmd\_tests.sh\, \cmd\_tests.source\) and its associated golden output files (e.g., \help.golden.stdout.cpp\, \jpath1.golden.stdout\) have been removed. This change eliminates the old shell-based verification method for the Jsonnet command-line interface, which previously tested features like argument parsing, library paths (\-J\), and stack trace limits via direct script execution.

_test\cmd · high confidence

Architecture

New internal infrastructure for Jsonnet function modules

This change introduces new internal Scala classes and traits (AbstractFunctionModule, FunctionBuilder, FunctionModule) to the sjsonnet library. These components provide a structured way to define and organize built-in Jsonnet functions, allowing for better management of function modules and their qualified names in error messages. This is a refactoring of the internal implementation details and does not change the external behavior or API of the Jsonnet language itself.

sjsonnet/src/sjsonnet/functions · high confidence

Standard library functions are split into dedicated submodules

The Jsonnet standard library has been reorganized from a single monolithic module into distinct submodules (Array, Encoding, Manifest, Math, NativeRegex, Object, Set, and StdLibModule). This structural change groups related functions—such as array operations, encoding utilities, and mathematical functions—into their own files, improving code maintainability and clarity without altering the public API surface.

sjsonnet/src/sjsonnet/stdlib · high confidence

Behavioural changes

Add JDK 17 benchmark suite for string and hashing operations

New benchmark resources have been added to the \jdk17\_suite\ directory to validate string manipulation and hashing performance. The suite includes \hash.jsonnet\, which tests MD5, SHA-1, SHA-256, SHA-512, and SHA-3 outputs on repeated seed payloads; \repeat\_format.jsonnet\, which verifies string repetition, decimal/hex formatting, and padding alignment; and \split\_resolve.jsonnet\, which tests string splitting, joining, and path resolution logic. Golden files are provided for each test to ensure output consistency.

_bench/resources/jdk17\suite · high confidence

Native SIMD-accelerated base64 encoding and decoding

The base64 encode and decode operations in the standard library now use a native implementation backed by the aklomp/base64 C library, enabling SIMD acceleration (SSSE3, AVX, NEON, etc.) for significantly faster performance. This change introduces a new \PlatformBase64.scala\ file that handles the foreign function interface and includes optimizations such as skipping UTF-8 conversion for ASCII-safe inputs. Additionally, the implementation enforces strict RFC 4648 compliance, meaning unpadded base64 input is now rejected during decoding, which differs from the previous lenient behavior on the JVM.

sjsonnet/src-native/sjsonnet/stdlib · high confidence

Optimized file caching to reduce memory usage for large imports

The sjsonnet engine now avoids loading large imported files entirely into memory. A new caching mechanism checks file sizes against a configurable threshold; files exceeding this limit are read directly from disk when needed, while smaller files remain cached. This prevents excessive memory consumption when processing large JSON or text imports, improving stability for large-scale configurations.

sjsonnet/src-jvm-native/sjsonnet · high confidence

Fixes

Fix for recursive deepJoin and flattenDeepArray hangs

The \deepJoin\ and \flattenDeepArray\ functions no longer hang on recursive inputs. This is achieved by introducing \DeepArrayActiveSet\, a custom hash-set implementation that tracks visited arrays by identity to prevent infinite loops during traversal.

sjsonnet/src-js/sjsonnet/stdlib · high confidence

Fix hangs in recursive deepJoin and flattenDeepArray operations

The sjsonnet standard library now prevents infinite loops and hangs when processing deeply nested arrays with recursive operations like deepJoin and flattenDeepArray. This is achieved by introducing a new DeepArrayActiveSet to track visited arrays during traversal, ensuring each array is processed only once. Additionally, the gzip function has been refactored into a dedicated NativeGzip module for better organization.

sjsonnet/src-jvm-native/sjsonnet/stdlib · high confidence

Fix performance regression in large JSON import merging

Resolves a performance regression (issue \#840) where merging large imported JSON objects using the \+\ operator caused O(N²) materialization time. The fix optimizes the handling of large inline objects by lazily building an O(1) lookup map during field resolution, ensuring that adding fields to large imported datasets remains efficient.

_bench/resources/sjsonnet\suite · high confidence

Prevent truncated output by waiting for output pump to finish

The sjsonnet client now waits for the background thread responsible for forwarding server output to stdout/stderr to complete before exiting. Previously, the client could terminate while this thread was still writing, leading to empty or truncated output in scenarios such as the second invocation reusing a server. This change ensures that all output is fully flushed to the user before the process returns its exit code.

sjsonnet/client · high confidence

Test coverage

Added CLI and error-handling test cases; Added GraalVM native image test suite; Added JVM-specific test coverage for core sjsonnet components; Added JVM/Native test infrastructure and coverage for shared functionality; Added JavaScript-specific test infrastructure and async import validation; Added base64 encoding benchmark to the regression suite; Added end-to-end integration tests for the sjsonnet client/server IPC flow; Added go-jsonnet test suite for sjsonnet; Added golden output refresh script for test suites; Added regression benchmarks for deep array traversal and object assertions; Added test cases for import argument validation errors; Added test resources for mixins and string quoting; Added tests for external access to Val.Str extractor; Added tests for the native xz compression function; Added unit tests for client I/O utilities and lock implementations; Expanded test coverage for core Jsonnet behaviors; Expanded test coverage for sjsonnet core evaluation and optimization; New JMH benchmark suite for sjsonnet performance profiling; Updated test suite with new assertions and error cases.

Dependencies

SJSONNET 0.4.15.1 dependency updates and Scala 3.3.8 upgrade

This release updates several core dependencies, including ujson to 4.4.3, lz4-java to 1.10.3, snakeyaml to 2.6, and re2j to 1.8. It also upgrades the Scala version to 3.3.8 and enables the -Yfuture-lazy-vals compiler flag, which may affect code relying on lazy val initialization order. The build now targets JDK 11 for both compilation and runtime.

(dependencies) · high confidence

Housekeeping

Initial repository setup with Mill build and Scala 3 tooling

The repository is initialized with a Mill build system (build.mill) configured to cross-compile against Scala 2.12, 2.13, and 3.3, replacing previous build tools. The project now uses scalafmt (version 3.11.5) for code formatting, enforced via a new .scalafmt.conf, and includes a mill launcher script (mill) to manage the build tool version. Documentation is structured with CLAUDE.md for agent instructions and AGENTS.md as an entry point, while the CHANGELOG.md is established to track releases from version 0.1.2 through 0.6.0.

(repo-wide) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 56 → 49 (-6.3)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 55 → 55 (+0.0)
  • Architecture 90 → 89 (-1.2)
  • Maturity 59 → 56 (-2.3)
  • Readiness 53 → 52 (-1.6)
  • Security 88 → 89 (+0.5)
  • Accessibility 53 → 40 (-12.6)
  • Performance 76 → 76 (+0.0)

Resolved (5)

  • Documentation: contradicts the code (bench/resources/README.md)
  • Off-boarding risk: anonymized user #1
  • Outdated: at.yawk.lz4:lz4-java
  • Outdated: org.tukaani:xz
  • Outdated: org.yaml:snakeyaml

New (4)

  • Dependency hygiene PARTLY measured — sbt declarations read, dependency currency not (Maven Central unreachable)
  • Off-boarding risk: anonymized user #1
  • Orphaned file (sjsonnet/client/src/sjsonnet/client/Util.java)
  • Orphaned files with no living knowledge

Architecture

  • Unchanged — 0 containers · 1 contexts · 0 edges

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

databricks/sjsonnet was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 6 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit b6bf60a9e1fa90e50c878ee00895f95ef7dd3bba — the exact code this score is about.
  • Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.3+preprod-60d1b390edf0.