Skip to content

v0.7.8 — document-level ToUnicode CMap cache

Choose a tag to compare

@Detective-XH Detective-XH released this 12 Jun 01:51
· 162 commits to master since this release
v0.7.8
8d4a978

Performance

  • CJK and other ToUnicode-based text extraction is substantially faster and
    lighter: a font's ToUnicode character map is now decoded once per document
    instead of re-parsed on every page of every extraction pass. Repeated
    extraction calls and multi-page documents reuse the decoded map, which is
    bounded in memory and safe for concurrent use. Output is byte-identical — the
    cache only changes when a map is parsed, never what it decodes to. On a
    22-page Traditional-Chinese document, Reader.GetPlainText drops −28 % time,
    −35 % bytes, −18 % allocations
    ; cold open-and-extract −26 % / −31 % /
    −17 %
    ; and Reader.DebugJSON a further −12 % / −10 % / −11 %.

  • Reader.DebugJSON / Page.DebugJSON got faster and lighter again: each page's
    words are no longer assembled twice. Building on the v0.7.7 single-interpret change,
    the structured-export path now reuses the words it already grouped into lines to
    drive its routing summary, instead of re-grouping the page from scratch. On a
    22-page CJK document Reader.DebugJSON drops from 67.1 to 59.7 ms/op (−11 %),
    74.8 to 59.3 MB/op (−21 %), and allocations from 921k to 863k per call
    (−6 %)
    . The output is byte-identical.

Verify this release

This is a signed git tag (ED25519-SK / FIDO2 hardware key). The maintainer's
trusted signing keys are published on the GitHub account, so nothing needs to be
copied from these notes:

curl -s https://api.github.com/users/Detective-XH/ssh_signing_keys \
  | python3 -c "import json,sys; [print('*', k['key']) for k in json.load(sys.stdin)]" > allowed_signers
git -c gpg.ssh.allowedSignersFile=./allowed_signers tag -v v0.7.8
# expect: Good "git" signature for * with an ED25519-SK key

Module integrity is independently guaranteed by the Go checksum database:

go mod download github.com/Detective-XH/gopdf@v0.7.8 && go mod verify