A high-throughput parser for the Zig programming language
1–10 of 18 posts
Re: A high-throughput parser for the Zig programming language
#2I wonder if there's a way to make this set of techniques less brittle and more applicable to any language. I guess you're looking at a new backend or some enhancements to one of the parser generator tools.
Re: A high-throughput parser for the Zig programming language
#3Very interesting project! I wonder if there's a way to make this set of techniques less brittle and more applicable to any language. I guess you're looking at a new backend or some enhancements to one of the parser generator tools.
I get:
- ~4 MLOC/sec/core on a laptop
- ~ 8-9MLOC/sec/core on a modern AMD sever grade CPU with AVX512.
So yes, it is definitively possible.
Re: A high-throughput parser for the Zig programming language
#4Re: A high-throughput parser for the Zig programming language
#5I guess they are too tailored to the actual memory layout with respective memory access delay of the architecture, but I would like to be shown that I am wrong and it is feasible.
Re: A high-throughput parser for the Zig programming language
#6Very interesting project! I wonder if there's a way to make this set of techniques less brittle and more applicable to any language. I guess you're looking at a new backend or some enhancements to one of the parser generator tools.
Re: A high-throughput parser for the Zig programming language
#7https://github.com/williamw520/misc_zig/blob/main/identifier...
Re: A high-throughput parser for the Zig programming language
#8This is very cool. Extremely fast lexical tokenizer is the basis for a fast compiler. Zig has good integration and support for SIMD operations that's perfect for this kind of things. It's definitely doable. I did a proof of concept on using SIMD to operate on 32-byte chunk to parse identifiers a while back. https://github.com/williamw520/misc_zig/blob/main/identifier...
I assume there is some other use case that is motivating this work.
Re: A high-throughput parser for the Zig programming language
#9This is very cool. Extremely fast lexical tokenizer is the basis for a fast compiler. Zig has good integration and support for SIMD operations that's perfect for this kind of things. It's definitely doable. I did a proof of concept on using SIMD to operate on 32-byte chunk to parse identifiers a while back. https://github.com/williamw520/misc_zig/blob/main/identifier...
When I run a profiler on a compiler I wrote (which parses at somewhere between 500K-1MM lines per second without a separate lexer), parsing barely shows up. I'd be very surprised if the zig compiler is spending more than 5% of the time tokenizing. I assume there is some other use case that is motivating this work.