Skip to content

feat: deprecate estimateSize and use v8 serialisation directly#10

Merged
kt3k merged 1 commit intodenoland:mainfrom
kitsonk:pr-estimate-size
Jun 17, 2025
Merged

feat: deprecate estimateSize and use v8 serialisation directly#10
kt3k merged 1 commit intodenoland:mainfrom
kitsonk:pr-estimate-size

Conversation

@kitsonk
Copy link
Copy Markdown
Contributor

@kitsonk kitsonk commented Jun 10, 2025

Deploy now supports accessing v8 serialize via "node:v8" which means everywhere you would reasonable run Deno KV (including Bun) supports serialize from "node:v8". This effectively makes the functionality in

Previously, the performance in Deno of serialize was poor, but recent versions have it faster than the original estimation function:

    CPU | Apple M1 Pro
Runtime | Deno 2.3.5 (aarch64-apple-darwin)

file:///.../estimate_size.bench.ts

benchmark      time/iter (avg)        iter/s      (min … max)           p75      p99     p995
-------------- ----------------------------- --------------------- --------------------------
estimateSize            7.6 µs       131,500 (  4.1 µs … 826.6 µs)   5.0 µs  48.4 µs  51.5 µs
V8 serialize            5.7 µs       174,000 (  4.0 µs …   8.1 µs)   7.0 µs   8.1 µs   8.1 µs

Based on this, estimateSize is redundant and less accurate than using serialize directly and should be deprecated and eventually removed.

Copy link
Copy Markdown
Contributor

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

LGTM

@kt3k kt3k merged commit f92a46e into denoland:main Jun 17, 2025
5 checks passed
@kt3k
Copy link
Copy Markdown
Contributor

kt3k commented Jun 17, 2025

published as 0.1.4 https://jsr.io/@deno/kv-utils@0.1.4

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.

2 participants