2 ms·
Even if you do this, the CPU still ultimately has to synchronize if you put the workflow across threads, so you have to get a contention hit somewhere. (Lockfre
by jchw 4y ago
Even if you do this, the CPU still ultimately has to synchronize if you put the workflow across threads, so you have to get a contention hit somewhere. (Lockfree data structures still hit locks in the silicon, after all.) I could be wrong, but when it comes to performance it seems like your best option is moving the concurrency elsewhere. For design? I dunno. I find the design to be elegant for sure, but I also don’t mind handwriting parsers in general.
- alex_smart 4y agoThe lexer is entirely single-threaded, as in the original Rob Pike talk. >I find the design to be elegant for sure, but I also don’t mind handwriting parsers in general. But this is a hand-written parser! Just using function pointers to store the state instead of using an enum and switch statements.
- jchw 4y agoYep, fair enough. As a single-threaded design, I have no particular problems with it.