Counting Words at SIMD Speed
healeycodes.com
Counting Words at SIMD Speed
1–10 of 16 posts
Re: Counting Words at SIMD Speed
#2Re: Counting Words at SIMD Speed
#3There Ain’t No Such Thing as the Fastest Code: Lessons Learned in the Pursuit of the Ultimate Word Counter
Article: https://www.phatcode.net/res/224/files/html/ch16/16-01.html
Code: https://www.phatcode.net/res/224/files/html/ch16/16-05.html
Re: Counting Words at SIMD Speed
#4This was a nice opportunity to learn about Grand Central Dispatch through AI for me as well. I knew about the page alignment and async read techniques but not on OSX.
Edit: actually you can get even faster with mmap https://github.com/healeycodes/counting-words-at-simd-speed/...
Re: Counting Words at SIMD Speed
#5Also, when counting 0xFF bytes from a boolean etc., sub the mask; 0xFF == -1.
Re: Counting Words at SIMD Speed
#6Re: Counting Words at SIMD Speed
#7 Benchmark 1: python3 0_mvp.py bench.txt
Time (mean ± σ): 104.739 s ± 3.982 s [User: 104.213 s, System: 0.158 s]
Range (min … max): 100.303 s … 108.005 s 3 runs
Benchmark 2: python3 1_c_regex.py bench.txt
Time (mean ± σ): 14.777 s ± 0.017 s [User: 14.563 s, System: 0.158 s]
Range (min … max): 14.759 s … 14.791 s 3 runs
Benchmark 1: pypy3 0_mvp.py bench.txt
Time (mean ± σ): 9.381 s ± 0.204 s [User: 9.110 s, System: 0.234 s]
Range (min … max): 9.245 s … 9.616 s 3 runs
Benchmark 2: pypy3 1_c_regex.py bench.txt
Time (mean ± σ): 4.296 s ± 0.031 s [User: 4.038 s, System: 0.236 s]
Range (min … max): 4.262 s … 4.324 s 3 runsRe: Counting Words at SIMD Speed
#8Re: Counting Words at SIMD Speed
#9Idea being, this is constant in the size of the query set.
Re: Counting Words at SIMD Speed
#10[1]: https://github.com/ashvardanian/StringZilla/blob/2f4b1386ca2...
[2]: https://github.com/ashvardanian/StringZilla/blob/2f4b1386ca2...