Hacker News new | past | comments | ask | show | jobs | submit
It will crash.

But so will every other tool, because it is things like a C++ header file with 128MB of PNG data hardcoded as an array.

Editors don’t even open those files.

Fair enough.

But then I would rephrase that because it's confusing, and not doing justice to your tool.

Good point.

Thanks!

Perhaps it could just check the length of files and not crash?!? Don’t you think that’s sensible?
It's a tradeoff. The length itself is not a problem. It will happily diff normal multi-MB files.

The problem is the degenerative syntax tree that TreeSitter produces in case of, for example a multi-million array of bytes. This causes a stack overflow in the TreeSitter C code which takes down the Rust process with it.

The correct solution would be to prevent TS from crashing, or isolate the C<->Rust boundary better.

Or just, not support that for v0.3. Because if you are diffing the collected works of Shakespeare as a binary blob in a C++ header, maybe diffing isn't your biggest problem.

> Editors don’t even open those files.

vi opens multi-GB files just fine.

And for multi-TB files, "less -n" works.

You need to broaden your horizons about editors. Not all of then are javascript-based slopfests

The crash will happen in TreeSitter which is a widely used AST library that all modern editors, including neovim, depend on for syntax highlighting and which is also used by many LSPs.

Additionally, here's an appropriate XKCD: https://xkcd.com/378/

Please demonstrate that crash on “less -n” or vim with no plugins. I just happily opened a multi gb file in both. No issue
loading story #50335599