Live data from Hacker News

Zpdf: PDF text extraction in Zig

github.com

21–30 of 88 posts

Re: Zpdf: PDF text extraction in Zig

#21
post #2

I built a PDF text extraction library in Zig that's significantly faster than MuPDF for text extraction workloads. ~41K pages/sec peak throughput. Key choices: memory-mapped I/O, SIMD string search, parallel page extraction, streaming output. Handles CID fonts, incremental updates, all common compression filters. ~5,000 lines, no dependencies, compiles in Why it's fast: - Memory-mapped file I/O (no read syscalls) - Z…

What’s the fidelity like compared to tika?

Re: Zpdf: PDF text extraction in Zig

#22
post #9
post #7

Now we just need Python bindings so I can use it in my trash language of choice.

added python bindings!

Were you working on it already, or did it take you less than 17 minutes to commit https://github.com/Lulzx/zpdf/commit/9f5a7b70eb4b53672c0e4d8... ?

Re: Zpdf: PDF text extraction in Zig

#23
post #2

I built a PDF text extraction library in Zig that's significantly faster than MuPDF for text extraction workloads. ~41K pages/sec peak throughput. Key choices: memory-mapped I/O, SIMD string search, parallel page extraction, streaming output. Handles CID fonts, incremental updates, all common compression filters. ~5,000 lines, no dependencies, compiles in Why it's fast: - Memory-mapped file I/O (no read syscalls) - Z…

What’s the fidelity like compared to tika?

The accuracy difference is marginal (1-2%) but the speed difference is massive.

Re: Zpdf: PDF text extraction in Zig

#24

excellent stuff what makes zig so fast

Not being slow - they compile straight to bytecode, they aren't interpreted, and have aggressive, opinionated optimizations baked in by default, so it's even faster than compiled c (under default conditions.) Contrasted with python, which is interpreted, has a clunky runtime, minimal optimizations, and all sorts of choices that result in slow, redundant, and also slow, performance. The price for performance is safety…

Zig is safer than C under default conditions, not faster. By default does a lot of illegal behavior safety checking, such as array and slice bounds checking, numeric overflow checking, and invalid union access checking. These features are disabled by certain (non default) build modes, or explicitly disabled at a per scope level.

It may be easier to write code that runs faster in Zig than in C under similar build optimization levels, because writing high performance C code looks a lot like writing idiomatic Zig code. The Zig standard library offers a lot of structures like hash maps, SIMD primitives, and allocators with different performance characteristics to better fit a given use-case. C application code often skips on these things simply because it is a lot more friction to do in C than in Zig.

Re: Zpdf: PDF text extraction in Zig

#25
post #20

Earlier quoted context omitted.

> Are you using LLMs for parts of the coding? I can't talk about the code, but the readme and commit messages are most likely LLM-generated. And when you take into account that the first commit happened just three hours ago, it feels like the entire project has been vibe coded.

Hard disagree. Initial commit was 6k LOC. Author could've spent years before committing. Ill advised but not impossible.

Why would you make Claude write your commit message for a commit you've spent years working on though?

Re: Zpdf: PDF text extraction in Zig

#26

  74910,74912c187768,187779
  > myconv;
  
  > [Example 1: If you want to use the code conversion facet codecvt_utf8 to output to cout a UTF-8 multibyte sequence
  > corresponding to a wide string, but you don’t want to alter the locale for cout, you can write something like:
  >
  > § D.27.2
  > 1954
  >
  > © ISO/IEC
  > N4950
  >
  > wstring_convert> myconv;
  > std::string mbstring = myconv.to_bytes(L"Hello\n");
Is indeed faster but output is messier. And doesn't handle Unicode in contrast to mutool that does. (Probably also explains the big speed boost.)

Re: Zpdf: PDF text extraction in Zig

#27
post #20

Earlier quoted context omitted.

Hard disagree. Initial commit was 6k LOC. Author could've spent years before committing. Ill advised but not impossible.

Why would you make Claude write your commit message for a commit you've spent years working on though?

1. Be not good at or a fan of git when coding

2. Be not good at or a fan of git when committing

Not sure what the disconnect is.

Now if it were vibecoded, I wouldn't be surprised. But benefit of the doubt

Re: Zpdf: PDF text extraction in Zig

#28

- First commit 3hours ago. - commit message: LLM-generated. - README: LLM-generated. I'm not convinced that projects vibe coded over the evening deserve the HN front page… Edit: and of course the author's blog is also full of AI slop… 2026 hasn't even started I already hate it.

...and it does not work. I tried it on ~10 random pdfs, including very simple ones (e.g. a hello world from typst), it segfaults on every single one.

Re: Zpdf: PDF text extraction in Zig

#29

excellent stuff what makes zig so fast

It makes your development workflow smooth enough that you have the time and energy to do stuff like all the bullet points listed in https://news.ycombinator.com/item?id=46437289

>you have the time and energy to do stuff like all the bullet points listed

Don't disagree but in specific case, per the author, project was made via Claude Code. Although could as well be that Zig is better as LLM target. Noticed many new vibe projects decide to use Zig as target.

Re: Zpdf: PDF text extraction in Zig

#30

74910,74912c187768,187779 > myconv; > [Example 1: If you want to use the code conversion facet codecvt_utf8 to output to cout a UTF-8 multibyte sequence > corresponding to a wide string, but you don’t want to alter the locale for cout, you can write something like: > > § D.27.2 > 1954 > > © ISO/IEC > N4950 > > wstring_convert > myconv; > std::string mbstring = myconv.to_bytes(L"Hello\n"); Is indeed faster but output…

fixed.
Post reply on HN