Earlier quoted context omitted.
> Zip with no compression is a nice contender for a container format that shouldn't be slept on SquashFS with zstd compression is used by various container runtimes, and is popular in HPC where filesystems often have high latency. It can be mounted natively or with FUSE, and the decompression overhead is not really felt.
Wouldn't you still have a lot of syscalls?
I built a 2x faster lexer, then discovered I/O was the real bottleneck
31–40 of 96 posts
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#32Earlier quoted context omitted.
Isn't this what is already common in the Python community? > I don't want to unpack an archive and have to scrutinize it for files with o+rxst permissions, or have their creation date be anything other than when I unpacked them. I'm the opposite, when I pack and unpack something, I want the files to be identical including attributes. Why should I throw away all the timestamps, just because the file were temporarily i…
> Why should I throw away all the timestamps, just because the file were temporarily in an archive? In case anyone is unaware, you don't have to throw away all the timestamps when using "zip with no compression". The metadata for each zipped file includes one timestamp (originally rounded to even number of seconds in local time). I am a big last modified timestamp fan and am often discouraged that scp, git, and even…
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#33Of course syscalls suck, slurping the whole file at once always wins, and in this case all files at once.
Kernels suck in general. You don't really need one for high perf and low space.
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#34Zip 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?
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#35Headline 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?
What comes closest is scandir [1], which gives you an iterator of direntries, and can be used to avoid lstat syscalls for each file. Otherwise you can open a dir and pass its fd to openat together with a relative path to a file, to reduce the kernel overhead of resolving absolute paths for each file. [1] https://man7.org/linux/man-pages/man3/scandir.3.html
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#36Headline 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
#37Headline 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?
What comes closest is scandir [1], which gives you an iterator of direntries, and can be used to avoid lstat syscalls for each file. Otherwise you can open a dir and pass its fd to openat together with a relative path to a file, to reduce the kernel overhead of resolving absolute paths for each file. [1] https://man7.org/linux/man-pages/man3/scandir.3.html
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#38Same thing applies to other system aspects: compressing the kernel loads it faster on RAM even if it still has to execute the un compressing operation. Why? Load from disk to RAM is a larger bottleneck than CPU uncompressing. Same is applied to algorithms, always find the largest bottleneck in your dependent executions and apply changes there as the rest of the pipeline waits for it. Often picking the right algorithm…
Re: I built a 2x faster lexer, then discovered I/O was the real bottleneck
#39Zip 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
#40Earlier quoted context omitted.
What comes closest is scandir [1], which gives you an iterator of direntries, and can be used to avoid lstat syscalls for each file. Otherwise you can open a dir and pass its fd to openat together with a relative path to a file, to reduce the kernel overhead of resolving absolute paths for each file. [1] https://man7.org/linux/man-pages/man3/scandir.3.html
in what way does scandir avoid stat syscalls?
Notice that this avoids `lstat` calls; for symlinks you may still need to do a stat call if you want to stat the target.