Skip to content

Reduce text insert and import overhead#1022

Merged
zxch3n merged 2 commits into
mainfrom
fix/text-insert-import-regressions
Jun 17, 2026
Merged

Reduce text insert and import overhead#1022
zxch3n merged 2 commits into
mainfrom
fix/text-insert-import-regressions

Conversation

@zxch3n

@zxch3n zxch3n commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

  • avoid duplicate text insert boundary validation and add a fast path for coordinate systems where every text position is already a valid boundary
  • skip eager imported change block validation during snapshot/update import
  • make lazy external change block decode paths return failure instead of panicking when malformed blocks are encountered
  • fix a default-feature compile error in an arena test and sync Cargo.lock for the current loro-wasm version

Rationale

Text insert was paying boundary validation costs twice on the attached path, and ASCII style workloads could avoid the expensive conversion round trip entirely. Snapshot import was also parsing every imported change block immediately via validate_imported_change_blocks even though the import blob and sstable layers already verify checksums. This keeps import on the lazy path while preserving non-panic behavior if a malformed block is encountered later.

Validation

  • cargo check -p loro-internal
  • cargo test -p loro-internal import_rejects
  • cargo test -p loro-internal --test test test_from_snapshot
  • cargo test -p loro --test text
  • cargo test -p loro-internal --lib
  • rustfmt --check crates/loro-internal/src/oplog/change_store.rs crates/loro-internal/src/oplog/change_store/block_encode.rs
  • git diff --check

Notes

  • pnpm -C crates/loro-wasm build-release was attempted after installing Deno. Rust build, wasm-bindgen, rollup, TypeScript, Vitest, and Deno tests passed, but the final bun test step could not run because bun is not installed in this environment.

@github-actions

Copy link
Copy Markdown
Contributor

WASM Size Report

  • Original size: 3037.14 KB
  • Gzipped size: 1001.43 KB
  • Brotli size: 703.08 KB

@zxch3n zxch3n merged commit 1727258 into main Jun 17, 2026
1 check passed
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