I wanted to take a peek the state diagram (ASCII version). But I was feeling lazy, so apologies for having ChatGPT do the work for me. I wasn't going for correctness and didn't check it. If you're like me, here you go: https://dreampuf.github.io/GraphvizOnline/#digraph%20StateMa... digraph StateMachine { rankdir=LR; size="8,5"; node [shape = circle]; LookingForWord -> InsideWord [label="Non-space"]; LookingForWord ->…
Wc2: Investigates optimizing 'wc', the Unix word count program
21–30 of 157 posts
Re: Wc2: Investigates optimizing 'wc', the Unix word count program
#22> The difference in macOS and Linux speed is actually the difference in clang and gcc speed. The LLVM clang compiler is doing better optimizations for x86 processors here.
I know GCC has been getting much, much more aggressive as of late, but there have been some complaints that it is now much, much less safe (checks intended for security getting optimized away, e.g.).
I wonder if you were to go back to 5 years ago, if you'd see the linux code was generally safer than the speedy osx llvm code...
Re: Wc2: Investigates optimizing 'wc', the Unix word count program
#23I wanted to take a peek the state diagram (ASCII version). But I was feeling lazy, so apologies for having ChatGPT do the work for me. I wasn't going for correctness and didn't check it. If you're like me, here you go: https://dreampuf.github.io/GraphvizOnline/#digraph%20StateMa... digraph StateMachine { rankdir=LR; size="8,5"; node [shape = circle]; LookingForWord -> InsideWord [label="Non-space"]; LookingForWord ->…
This is a useless contribution to the discussion, maybe even negative... Why didn't you check it at least before sharing?
Re: Wc2: Investigates optimizing 'wc', the Unix word count program
#24Re: Wc2: Investigates optimizing 'wc', the Unix word count program
#25> No, you aren't suppose to be able to see how the word-count works by looking at this code. The complexity happens elsewhere, setting up the state-machine. This is like most of the reason I opened this article. I wish they'd spend more time talking about this. In fact, most of the README covers details that are important, but, irrelevant to their algorithmic improvements. Maybe they expect you to open up the code, b…
The explanation it provides regarding Apache vs Ngnix seemed to me to imply that Apache requires memory allocation to read headers into buffers and Ngnix uses a state machine to avoid memory allocation. Memory allocation is slower than most people realise.
Re: Wc2: Investigates optimizing 'wc', the Unix word count program
#26Re: Wc2: Investigates optimizing 'wc', the Unix word count program
#27> This is analogous to NFA and DFA regular-expressions. If you use the NFA approach, you need to buffer the entire chunk of data, so that the regex can backtrack. Using the DFA approach, input can be provided as a stream Sorry, no, this is completely wrong. There are other reasons NFAs or DFAs might be preferable, and there are other performance considerations as far as backtracking is concerned, but NFA implementati…
Re: Wc2: Investigates optimizing 'wc', the Unix word count program
#28I was a bit surprised by the macos/linux speed differential here: > The difference in macOS and Linux speed is actually the difference in clang and gcc speed. The LLVM clang compiler is doing better optimizations for x86 processors here. I know GCC has been getting much, much more aggressive as of late, but there have been some complaints that it is now much, much less safe (checks intended for security getting optim…
Re: Wc2: Investigates optimizing 'wc', the Unix word count program
#29This word count challenge was the first one he described. The table driven approach was discussed, but was not necessarily the fastest due to the large cache overflowing (on 90s processors) table needed.
I used the same example in a chapter I wrote for a C++ book
Re: Wc2: Investigates optimizing 'wc', the Unix word count program
#30Earlier quoted context omitted.
This is a useless contribution to the discussion, maybe even negative... Why didn't you check it at least before sharing?
Why? Because it's wrong? If it were correct, wouldn't it be useful?