Headline is wrong. I/O wasn't the bottleneck, syscalls were the bottleneck. Stupid question: why can't we get a syscall to load an entire directory into an array of file descriptors (minus an array of paths to ignore), instead of calling open() on every individual file in that directory? Seems like the simplest solution, no?
io_uring supports submitting openat requests, which sounds like what you want. Open the dirfd, extract all the names via readdir and then submit openat SQEs all at once. Admittedly I have not used the io uring api myself so I can't speak to edge cases in doing so, but it's "on the happy path" as it were. https://man7.org/linux/man-pages/man3/io_uring_prep_open.3.h... https://man7.org/linux/man-pages/man2/readdir.2.ht…
I built a 2x faster lexer, then discovered I/O was the real bottleneck
51–60 of 96 posts
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#52Zip with no compression is a nice contender for a container format that shouldn't be slept on. It effectively reduces the I/O, while unlike TAR, allowing direct random to the files without "extracting" them or seeking through the entire file, this is possible even via mmap, over HTTP range queries, etc. You can still get the compression benefits by serving files with Content-Encoding: gzip or whatever. Though it has…
Doesn’t ZIP have all the metadata at the end of the file, requiring some seeking still?
With tar you need to scan the entire file start-to-finish before you know where the data is located, as it's literally a tape archiving format, designed for a storage medium with no random access reads.
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#53Zip with no compression is a nice contender for a container format that shouldn't be slept on. It effectively reduces the I/O, while unlike TAR, allowing direct random to the files without "extracting" them or seeking through the entire file, this is possible even via mmap, over HTTP range queries, etc. You can still get the compression benefits by serving files with Content-Encoding: gzip or whatever. Though it has…
> I wouldn't expect this to be something that transfers between machines Maybe non-UNIX machines I suppose. But I 100% need executable files to be executable.
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#54Zip with no compression is a nice contender for a container format that shouldn't be slept on. It effectively reduces the I/O, while unlike TAR, allowing direct random to the files without "extracting" them or seeking through the entire file, this is possible even via mmap, over HTTP range queries, etc. You can still get the compression benefits by serving files with Content-Encoding: gzip or whatever. Though it has…
> I wouldn't expect this to be something that transfers between machines Maybe non-UNIX machines I suppose. But I 100% need executable files to be executable.
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#55Zip with no compression is a nice contender for a container format that shouldn't be slept on. It effectively reduces the I/O, while unlike TAR, allowing direct random to the files without "extracting" them or seeking through the entire file, this is possible even via mmap, over HTTP range queries, etc. You can still get the compression benefits by serving files with Content-Encoding: gzip or whatever. Though it has…
I thought Tar had an extension to add an index, but I can't find it in the Wikipedia article. Maybe I dreamt it.
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#56Zip with no compression is a nice contender for a container format that shouldn't be slept on. It effectively reduces the I/O, while unlike TAR, allowing direct random to the files without "extracting" them or seeking through the entire file, this is possible even via mmap, over HTTP range queries, etc. You can still get the compression benefits by serving files with Content-Encoding: gzip or whatever. Though it has…
The real one-two punch is make your parser faster and then spend the CPU cycles on better compression.
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#57Headline is wrong. I/O wasn't the bottleneck, syscalls were the bottleneck. Stupid question: why can't we get a syscall to load an entire directory into an array of file descriptors (minus an array of paths to ignore), instead of calling open() on every individual file in that directory? Seems like the simplest solution, no?
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#58Zip with no compression is a nice contender for a container format that shouldn't be slept on. It effectively reduces the I/O, while unlike TAR, allowing direct random to the files without "extracting" them or seeking through the entire file, this is possible even via mmap, over HTTP range queries, etc. You can still get the compression benefits by serving files with Content-Encoding: gzip or whatever. Though it has…
Gzip will make most line protocols efficient enough that you can do away with needing to write a cryptic one that will just end up being friction every time someone has to triage a production issue. Zstd will do even better. The real one-two punch is make your parser faster and then spend the CPU cycles on better compression.
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#59Zip with no compression is a nice contender for a container format that shouldn't be slept on. It effectively reduces the I/O, while unlike TAR, allowing direct random to the files without "extracting" them or seeking through the entire file, this is possible even via mmap, over HTTP range queries, etc. You can still get the compression benefits by serving files with Content-Encoding: gzip or whatever. Though it has…
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#60Zip with no compression is a nice contender for a container format that shouldn't be slept on. It effectively reduces the I/O, while unlike TAR, allowing direct random to the files without "extracting" them or seeking through the entire file, this is possible even via mmap, over HTTP range queries, etc. You can still get the compression benefits by serving files with Content-Encoding: gzip or whatever. Though it has…