Search KetJS

Search titles, descriptions, and section headings.

    Diagram

    100%
    Drag to pan · Scroll or pinch to zoom · + / − to zoom · Arrow keys to pan · 0 to fit · 1 to reset
    Browse documentation
    Docs/Verify and deploy

    Benchmarks

    Compare KetJS database, HTTP, SSR and browser form performance with repeatable workloads and exact versions.

    Database execution

    Actual DB operations on 50,000 indexed rows. KetJS adapters and their raw drivers use the same engine, SQL and durability settings. Higher is better.

    SQLite — Indexed tenant read: 20 rows

    • KetJS adapter0.2.0 · range 53,386–59,478 /s56,771 operations/s
    • Raw driver baselinev24.14.1 · range 52,810–58,640 /s57,156 operations/s

    SQLite — Transaction: two balance updates

    • KetJS adapter0.2.0 · range 4,594–21,973 /s21,061 transactions/s
    • Raw driver baselinev24.14.1 · range 21,432–23,910 /s22,713 transactions/s

    PostgreSQL — Indexed tenant read: 20 rows

    • KetJS adapter0.2.0 · range 884–1,083 /s928 operations/s
    • Raw driver baseline3.4.9 · range 923–1,124 /s963 operations/s

    PostgreSQL — Transaction: two balance updates

    • KetJS adapter0.2.0 · range 215–286 /s278 transactions/s
    • Raw driver baseline3.4.9 · range 89–265 /s182 transactions/s
    More database workloads

    SQLite — Primary-key lookup

    • KetJS adapter0.2.0 · range 164,904–176,349 /s169,577 operations/s
    • Raw driver baselinev24.14.1 · range 145,194–190,669 /s174,264 operations/s

    SQLite — Single committed insert

    • KetJS adapter0.2.0 · range 15,023–16,675 /s16,240 operations/s
    • Raw driver baselinev24.14.1 · range 16,372–17,134 /s16,956 operations/s

    SQLite — Transaction: 25 inserts

    • KetJS adapter0.2.0 · range 5,323–6,277 /s5,637 transactions/s
    • Raw driver baselinev24.14.1 · range 4,253–6,907 /s5,890 transactions/s

    PostgreSQL — Primary-key lookup

    • KetJS adapter0.2.0 · range 821–954 /s949 operations/s
    • Raw driver baseline3.4.9 · range 897–1,096 /s999 operations/s

    PostgreSQL — Single committed insert

    • KetJS adapter0.2.0 · range 228–427 /s310 operations/s
    • Raw driver baseline3.4.9 · range 215–419 /s318 operations/s

    PostgreSQL — Transaction: 25 inserts

    • KetJS adapter0.2.0 · range 29–38 /s34 transactions/s
    • Raw driver baseline3.4.9 · range 29–36 /s33 transactions/s

    HTTP server and database

    HTTP/1.1 over loopback, 16 keep-alive clients. Each server uses the same KetJS adapter and SQL. Higher is better; this is not a production capacity test.

    SQLite — HTTP + 20-row indexed read

    • KetJS0.2.0 · range 11,880–12,421 /s12,299 requests/s
    • Node HTTP baselinev24.14.1 · range 11,971–15,187 /s14,101 requests/s
    • Express5.2.1 · range 11,235–12,489 /s12,443 requests/s
    • Fastify5.12.5 · range 11,860–14,155 /s13,579 requests/s

    PostgreSQL — HTTP + 20-row indexed read

    • KetJS0.2.0 · range 843–1,188 /s918 requests/s
    • Node HTTP baselinev24.14.1 · range 789–1,011 /s931 requests/s
    • Express5.2.1 · range 833–1,190 /s1,005 requests/s
    • Fastify5.12.5 · range 813–1,007 /s953 requests/s
    More server workloads

    SQLite — HTTP JSON response

    • KetJS0.2.0 · range 16,632–21,543 /s20,759 requests/s
    • Node HTTP baselinev24.14.1 · range 12,564–25,956 /s23,815 requests/s
    • Express5.2.1 · range 13,941–19,290 /s17,534 requests/s
    • Fastify5.12.5 · range 17,919–22,962 /s19,270 requests/s

    SQLite — HTTP + primary-key lookup

    • KetJS0.2.0 · range 15,882–18,504 /s17,125 requests/s
    • Node HTTP baselinev24.14.1 · range 14,166–21,195 /s18,823 requests/s
    • Express5.2.1 · range 15,370–16,465 /s15,698 requests/s
    • Fastify5.12.5 · range 15,729–18,031 /s17,497 requests/s

    PostgreSQL — HTTP JSON response

    • KetJS0.2.0 · range 15,918–22,100 /s20,159 requests/s
    • Node HTTP baselinev24.14.1 · range 18,761–27,878 /s23,475 requests/s
    • Express5.2.1 · range 14,704–17,777 /s17,207 requests/s
    • Fastify5.12.5 · range 15,830–20,772 /s19,814 requests/s

    PostgreSQL — HTTP + primary-key lookup

    • KetJS0.2.0 · range 823–1,188 /s950 requests/s
    • Node HTTP baselinev24.14.1 · range 904–1,170 /s1,111 requests/s
    • Express5.2.1 · range 839–1,122 /s1,111 requests/s
    • Fastify5.12.5 · range 958–1,234 /s1,189 requests/s

    Server-side rendering

    Production-mode public render APIs, including element creation and HTML escaping. Equivalent product markup is verified. Higher is better.

    SSR: 50 products

    • ketjs-view0.2.011,562 renders/s
    • React19.3.010,602 renders/s
    • Svelte5.57.133,260 renders/s
    • Vue3.5.437,851 renders/s
    • Astro7.3.54,011 renders/s

    SSR: 1000 products

    • ketjs-view0.2.0539 renders/s
    • React19.3.0536 renders/s
    • Svelte5.57.11,858 renders/s
    • Vue3.5.43547 renders/s
    • Astro7.3.5827 renders/s

    How to read the comparisons#

    The HTML charts above use maintained summaries of the measured runs, with database execution first. Every bar is a median across independent Node processes with balanced framework order; each chart states how many. Bigger bars mean more completed operations per second. These measurements are workload-specific: they do not rank entire frameworks or prove production capacity.

    Database workloads#

    bench/ssr-comparison/database.mjs creates 50,000 products, a primary key and a composite (tenant, value, id) index. It measures an actual primary-key lookup, a tenant-filtered 20-row indexed read, an individually committed insert, a transaction containing 25 inserts and a two-update balance transfer. The unit for transactions is transactions/s, not individual statements/s. Seed data and migrations are outside timing; output rows, insert counts, total balances and rollback correctness are checked.

    SQLite uses a temporary on-disk file, WAL and synchronous=FULL (2). Both its KetJS adapter and raw node:sqlite baseline prepare each statement, so neither gets an artificial prepared-statement-cache advantage. PostgreSQL uses an owned, disposable PostgreSQL 17.10 Docker container with synchronous_commit=on and a one-connection pool for both the KetJS adapter and raw postgres.js baseline. Engine and driver versions appear beside the chart values.

    The raw driver is a lower-level baseline, not another business framework. These adapter operations do not include model validation, authorization, tenant resolution or a domain-function call. SQLite runs natively on macOS; PostgreSQL includes the Docker VM and local TCP path. Compare the two bars within one engine and workload, not SQLite versus PostgreSQL as a universal database ranking. Concurrent writes, lock contention, tenant fleets and production-sized datasets need separate fixtures.

    HTTP server workloads#

    bench/ssr-comparison/server.mjs compares KetJS, Express 5.2.1, Fastify 5.12.5 and a native Node HTTP baseline. All four use the same KetJS adapter, schema, SQL and JSON payload; this isolates routing/response overhead from ORM differences. The native KetJS server is created through its public createKetServer() API. Routes return a small JSON response, one product, or 20 indexed products.

    Each run uses 16 keep-alive HTTP/1.1 clients, 160 warm-up requests and 1,600 timed requests per route, on loopback. Every response status and result is checked. Timing includes the local load generator, JSON parsing and assertions. The charts report median throughput and observed throughput ranges. The PostgreSQL pool of one connection intentionally bounds concurrency; this is not a saturated production load test. Authentication, permissions, domain functions, TLS, proxies, compression, network distance and startup time are outside this fixture.

    SSR renderer workloads#

    bench/ssr-comparison/run.mjs compares ketjs-view 0.2.0, React 19.3.0, Svelte 5.57.1, Vue 3.5.43 and Astro 7.3.5. Each renders the same 50-row or 1,000-row product list with text escaping. ketjs-view, React and Vue create elements through their runtime element functions inside the timer. Svelte and Astro compile components/ProductList.svelte and components/ProductList.astro once before timing, as their builds would, so their template work is partly done ahead of time. The timed loop calls Svelte's render() from svelte/server and Astro's public Container API, renderToString(), which also runs Astro's component-rendering pipeline. The awaited public render API and encoding every result to bytes are included; imports are warm. Encoding keeps a renderer from returning an unflattened string whose cost would land after the timer. Output equivalence ignores hydration comments and the equivalent >/> text encoding. There is no HTTP, hydration or browser work in this comparison. Five processes each start the sequence at a different framework, on the same machine with Node.js 26.7.0.

    The chart was measured on an isolated Linux server (Intel Xeon E5-2680 v4, 28 logical CPUs) at commit 81850c19. At 50 rows ketjs-view 0.2.0 renders a little faster than React and Vue, well behind Svelte and ahead of Astro. At 1,000 rows ketjs-view, React and Vue are level, Astro is ahead of them and Svelte is about three times faster. Svelte and Astro gain from compiling the template before timing. Its JSX runtime caches each element shape, its server writer compiles each template once into static markup between holes, and escaping copies clean runs in one pass. The harness calls the runtime jsx() for every element, so it measures neither html templates nor the opt-in JSX compiler. Its independent dependency surface and island model are separate properties, not a speed claim inferred from this benchmark.

    Measurement environment#

    Raw run files and generated reports are not checked into the repository or served by this site. Chart summaries remain in this page's Markdown frontmatter. Re-run the harnesses below to inspect current raw results locally under .artifacts/benchmarks/.

    Measured 2026-10-07, using the KetJS 0.2.0 source: Node.js 24.14.1, macOS Darwin 25.2.0, Apple M1 Pro, arm64, 10 logical CPUs and 32 GiB RAM. Generated environment/digest records are local artifacts rather than published downloads.

    Node workloads ran three independent processes, sequentially. Tables report the median of those runs. Every workload validates its result before reporting it. The generated local reports record the source revision and digest. The database and HTTP code paths measured here are the same in 0.2.0.

    These are local microbenchmarks and regression baselines. The new comparisons below cover specific local workloads; they do not establish production HTTP capacity or universal framework speed ratios. Earlier competitor and KetSuite-domain tables have been removed because their old harnesses are no longer in this framework repository and were not rerun.

    Published npm footprint#

    Fresh isolated consumers install the exact published versions with installation scripts disabled, using node tools/benchmark-footprint.mjs. The 0.2.0 footprint is measured after that version is published; View Tools 0.2.0 adds acorn and acorn-jsx to its dependencies, and standalone View still has none.

    KTL rendering and query compilation#

    KTL renders fifty products with the same pre-created currency formatter on every render. Templates are compiled before timing, and output is checked byte-for-byte against a known result. Query timing includes construction of two predicates, ordering and a limit, then generation of SQLite SQL and parameters. It does not execute the query.

    Operation Iterations per run Median throughput
    KTL: 50 products with cached money filter 20,000 33,040/s
    Query: two predicates, order, limit and SQLite SQL 200,000 506,370/s

    This fixture makes no EJS, Liquid, Knex or Drizzle comparison; earlier speed ratios are not carried forward.

    Localization hot paths#

    Each process warms every path before timing. Inputs and iteration counts are fixed in bench/i18n.bench.ts; the date bucket uses Asia/Ho_Chi_Minh.

    Operation Median throughput
    plain translation 19,448,600 ops/s
    placeholder translation 4,056,011 ops/s
    plural translation 1,744,804 ops/s
    cached date/time format 676,641 ops/s
    timezone date bucket 502,159 ops/s

    No uncached baseline was measured during this run, so the table claims no cache improvement ratio.

    Module discovery startup#

    A catalogue contains 250 candidate modules; the selected dependency closure contains 40. Unselected modules throw if executed, and every measured resolution asserts the selected module count. The fixture now exports public defineModule() declarations instead of manually copying an old internal object shape.

    Cold means the first catalogue resolution in an already running process whose framework imports are loaded. Each process then performs 25 warm resolutions. The warm p95 below is the median of the three processes' internal p95 values, not a pooled percentile.

    Measure Median across three processes
    First resolution 34.95 ms
    Warm median 12.95 ms
    Warm p95 15.91 ms

    This is catalogue startup cost, not request throughput.

    SQLite queue across tenant databases#

    The public worker and tenant APIs handle 32 physical databases, 100 jobs per database and 8 concurrent workers. Notification shortcuts are disabled. Every run asserts all 3,200 jobs complete in the expected tenant, with migrations and runtime preparation outside the measured queue regions.

    Measure Median across three processes
    Enqueue time 473.4 ms
    Enqueue throughput 6,760.0 jobs/s
    Execution time 1,545.5 ms
    Execution throughput 2,071.0 jobs/s
    First-job spread across tenants 130.0 ms

    PostgreSQL was not measured in this run; its historical throughput is not presented as current. The fixture's jobs have minimal handlers, so these numbers do not represent a real domain workload.

    Real browser DOM updates#

    Chromium 154.0.8037.95, 1440 × 1000, light theme. The native TSX fixture mounts 1,000 keyed rows in a real DOM, performs five warmup rounds and thirty measured rounds, and checks the final row count and changed text. Timings include rendering and DOM API calls, excluding layout and paint. Browser timer resolution and background activity affect very short samples.

    Operation Median p95
    Mount 1,000 rows 4.70 ms 5.90 ms
    Update one row 1.10 ms 1.80 ms
    Unchanged render 1.00 ms 2.00 ms
    Swap two rows 1.00 ms 2.40 ms
    Remove and re-add one row (two renders) 2.30 ms 3.60 ms

    The old lit comparison used a different fixture and environment; no current cross-framework ratio is claimed.

    Browser form sessions#

    Measured 2026-10-09, at KetJS source revision d7af51c5 (ketjs-view 0.2.0), against React 19.3.0, React Hook Form 7.89.0 and Formik 2.4.9. The private bench/form-comparison/ deployment bundles minified production React with esbuild 0.28.2, without StrictMode. Environment: Apple M1 Pro, 32 GiB RAM, arm64 macOS Darwin 25.2.0, Node.js 24.14.1, Chromium 154.0.8037.95, 1440 × 900, device scale 1, light theme, no CPU throttling. This synthetic deployment is separate from KetSuite.

    Two fresh browser sessions each run two mounts per case and five warmup edits per mount. Library order rotates by case and mount. The figures below pool 80 valid edits and 20 invalid edits, recoveries and API submits per library/workload. Both runs have identical runtime/harness digests and diagnostic counters; 10,272 correctness assertions passed. The raw reports contain the source revision, package versions, environment, digests and individual samples and remain local under .artifacts/benchmarks/.

    Each library uses the same full-schema validator on change, a value mirror and error text per field, and dirty/error/pending status. RHF uses uncontrolled register with exact field subscriptions and memoized components; Formik uses FastField for independent fields. Nested fixtures initialize useFieldArray/FieldArray and contain stable row keys, nullable IDs, decimal weights, boolean flags and attribute-value records. Three controls per variant plus one title produce 31, 301 or 751 controls. KetJS flat forms use the default native adapter; its nested forms use a custom structured reader, equality-guarded writer and indexed issue lookup. KetJS mounts native controls once and updates field mirrors through effects with primitive computed selectors; the timer does not include a KetJS TSX component-tree render on each edit.

    Valid input changes#

    Elapsed time starts at synthetic input event dispatch and ends when raw state, dirty state, error text and the changed field's value-mirror DOM settle, including asynchronous React commits. The driver value assignment, preceding animation frame and correctness assertions are excluded. This does not measure layout, paint or INP. Each cell is median / p95, in milliseconds.

    Workload KetJS RHF Formik FastField
    10 flat fields 0.20 / 0.50 0.30 / 0.40 0.90 / 1.70
    100 flat fields 0.60 / 0.70 0.40 / 0.60 1.80 / 2.10
    500 flat fields 2.30 / 2.60 1.30 / 1.50 5.30 / 5.90
    10 variants, 31 controls 0.35 / 0.50 0.40 / 0.90 1.30 / 4.10
    100 variants, 301 controls 1.30 / 1.60 0.90 / 1.20 3.00 / 3.60
    250 variants, 751 controls 3.30 / 3.70 1.80 / 2.20 6.10 / 6.50

    One invalid field#

    The middle field becomes empty (flat) or a malformed decimal (nested). The same settlement boundary includes displaying its error. Each cell is median / p95, in milliseconds.

    Workload KetJS RHF Formik FastField
    10 flat fields 0.25 / 0.40 0.80 / 2.10 0.80 / 1.10
    100 flat fields 0.60 / 0.70 1.35 / 1.70 1.70 / 2.00
    500 flat fields 2.35 / 3.00 3.00 / 4.30 5.20 / 5.70
    10 variants, 31 controls 0.40 / 1.30 1.30 / 2.10 1.35 / 3.70
    100 variants, 301 controls 1.30 / 1.50 2.50 / 3.00 3.05 / 3.40
    250 variants, 751 controls 3.15 / 3.50 4.55 / 5.00 6.10 / 6.80

    Before and after the adapter fix#

    The earlier revision 756efdf9 rebuilt and searched the controls list for every issue/control pair, introducing quadratic work even for one issue. Revision d7af51c5 snapshots current controls once per pass, indexes their names, resolves each issue once, groups errors by field, guards DOM writes and caches baseline validation. The before/after runs have identical harness digests, package versions, viewport and workloads; each revision has two browser runs. Each cell is median / p95, in milliseconds.

    KetJS operation Before 756efdf9 After d7af51c5
    Valid edit, 500 flat fields 2.70 / 3.00 2.30 / 2.60
    One invalid field, 500 flat fields 64.05 / 65.80 2.35 / 3.00
    Valid edit, 250 variants 3.70 / 4.20 3.30 / 3.70

    The invalid-edit median is about 27× lower in this workload. This measures the combined adapter/cache fix, not an isolated contribution from each optimization. Full draft validation, copying, comparisons and control traversal still scale with draft/control size in this fixture. The nested fixture still uses its explicit structured reader/writer, so it does not establish default nested-path support.

    API submit and accepted baseline#

    These timers include client validation, a mock accepted receipt and baseline reset, with no HTTP or database. KetJS additionally snapshots mutation identity, checks receipts and locks native controls; RHF uses handleSubmit/reset, while Formik uses submitForm, projects accepted values through the shared schema and calls resetForm. These application flows have different library semantics, so the figures do not rank equivalent server transactions. Each cell is median / p95, in milliseconds.

    Workload KetJS RHF Formik FastField
    10 flat fields 0.20 / 0.50 0.60 / 1.40 0.20 / 0.60
    100 flat fields 0.80 / 1.00 2.55 / 3.80 0.40 / 0.50
    500 flat fields 4.70 / 5.20 12.80 / 14.40 2.20 / 2.70
    10 variants, 31 controls 0.45 / 0.90 1.30 / 2.60 0.30 / 0.70
    100 variants, 301 controls 2.50 / 2.80 6.60 / 8.40 1.10 / 1.20
    250 variants, 751 controls 6.65 / 8.10 19.60 / 23.00 2.80 / 3.10

    Render isolation and work behind it#

    Counters come from separate fresh mounts, with prototype wrappers and MutationObserver; timed mounts have neither. For one valid edit in an already dirty 500-field form after warmup:

    Counter KetJS RHF Formik FastField
    Field-view executions 1 1 1
    Unedited field-view executions 0 0 0
    Form component renders Not applicable 0 2
    Status view executions 1 0 2
    Completed root refinements 1 1 1
    Successful custom field-rule calls 500 500 500
    KetJS selector reads 500 Not applicable Not applicable
    Form aria-busy setter calls 0 0 0
    Input value setter calls 0 0 0
    Disabled-property writes 0 0 0
    Attribute method calls 0 0 0
    Text setter calls 2 1 1
    MutationObserver records 2 7 8

    On the invalid/recovery transitions, KetJS executes one field view and RHF/Formik execute the edited field twice; all three execute zero unedited field views. The extra React execution reflects the separate value/error updates. Clean-to-dirty status changes are exercised during warmup, not represented by the zero RHF status-render count in the valid-edit probe.

    View effects and React renders are different operations. Setter calls can assign unchanged values, and React can update defaultValue or attributes without assigning input.value. Mutation records also differ by DOM implementation. A small record count does not mean a small amount of adapter work. The legacy raw counter adapterEffects counts busy-attribute setters; with guarded writes it does not count actual adapter executions. Built-in validation is not represented by custom-rule counters, and a malformed structured child can skip the root refinement.

    KetJS validates the full draft on each edit and caches baseline validation until the baseline or a tracked rule dependency changes. Compared with the earlier 500-field probe, this reduces custom rule calls from 1,000 to 500 and removes 500 unchanged value/disabled assignments. Primitive selectors prevent unchanged field-view effects but still read the whole draft signal. At 250 variants, value/disabled/attribute writes are zero for a valid edit, while field and status mirrors perform two text writes. In a separate 100-field probe, reading session.values() directly in every field effect executes 100 field effects, including 99 unedited fields, instead of one with primitive selectors. See form render subscriptions.

    The native regression fixture at /regressions/ passes 4 cases and 46 assertions, including one control snapshot per update with 500 controls, one custom resolution per issue, dense error visibility, dynamic controls, unchanged-write guards, multiple descriptions, native submitters, disabled-fieldset preservation and unknown-outcome retry. Its reproduction steps are in bench/form-comparison/README.md. These are deterministic operation/behavior checks, not dense-error latency measurements.

    This removes the measured default-lookup bottleneck. More selective draft/subscription work may still help larger editors. The current validator is deliberately full-schema; incremental validation must preserve cross-field and structured constraints. The timings do not establish a universal library ranking. Array append/remove/reorder, comparative dense-error latency, async validation, memory/GC, mobile, Safari and actual KetSuite editor performance remain unmeasured.

    Renderer host operations#

    A separate counting-host fixture verifies the mutation cost independent of browser time. This fixture is not a DOM performance measurement.

    Change to 1,000 keyed rows Host operations
    Update one text field 1 setText
    Unchanged render 0
    Prepend one row 15
    Remove one row 3 removals
    Swap two rows 2 moves

    The former island-vs-whole-tree timings are not included: that fixture is absent, and counting operations does not recreate its timing claim.

    Reproduce#

    The Node harnesses write generated reports and raw runs to the ignored .artifacts/benchmarks/ directory. They do not update or publish the maintained Markdown summaries automatically.

    The Node harness needs emitted framework artifacts. Its build compiles the five-package workspace; it does not run the repository's test suites. Benchmark deployments are the synthetic headless catalogue fixture and queue_benchmark, not a KetSuite product deployment.

    # Run from: ketjs/
    npm run build
    node tools/benchmark-report.mjs
    node tools/benchmark-footprint.mjs
    node tools/benchmark-browser.mjs
    # Separate browser-form deployment; open its URL and click Run benchmark:
    npm ci --prefix bench/form-comparison --ignore-scripts
    npm start --prefix bench/form-comparison
    # Separate terminal for the comparative fixtures:
    npm ci --prefix bench/ssr-comparison --ignore-scripts
    node tools/benchmark-ssr.mjs
    # Docker must already have postgres:17.10-alpine; no shared service is modified.
    node tools/benchmark-server-db.mjs

    Open http://127.0.0.1:3701/ and press Run benchmark for the real browser fixture. Save its JSON results and browser environment locally under .artifacts/benchmarks/ before closing the benchmark page. The footprint command installs only the three named npm consumers into disposable directories.

    The form comparison opens at http://127.0.0.1:39751/ and saves completed runs automatically. Its independent install and methodology are documented in bench/form-comparison/README.md. Run node --test bench/form-comparison/workload.test.mjs for its focused harness checks.

    Not measured here#

    • Current EJS, Liquid, Knex, Drizzle and lit comparisons need pinned competitor versions and equivalent maintained fixtures.
    • PostgreSQL queue throughput needs an isolated database service and a separately recorded run.
    • Product, pricing, stock, hospitality and storage workloads belong to KetSuite or its deployment repositories. Their old numbers no longer appear as KetJS-framework benchmarks.
    • Production HTTP capacity, concurrency/lock contention, layout/paint and full-page versus island timings need dedicated workloads beyond these local fixtures.

    Those gaps are explicit; there are no reused historical numbers standing in for fresh measurements.

    View source on GitHub ↗KetJS 0.8.1 preview