Top all-time · #2332
strchr.com updates
Personal blog · strchr.com · on HN as abareplaceprogrammingsystems
strchr.com updates is a personal blog at strchr.com about programming and systems. Since 2009, 33 different Hacker News readers have linked it 44 times, most often “Hash functions: An empirical comparison (2008)”. The last post was in 2019, but the archive is still widely read.
Too few sampled comments (23) to say how often HN recommends it.?
Why HN links it
HN readers link strchr.com for technical posts on hash function benchmarks, x86 machine code and instruction statistics, and SSE string instructions, and cite its pages as evidence.
Summarised by Claude from a sample of 23 HN comments that link here. Each comment is marked recommending, critical or neutral (citing without judging); how this works.
Most-linked posts?
- Hash functions: An empirical comparison (2008)8 people · 8 mentions · first linked 2016-07-24
- Hash functions: An empirical comparison (2008)5 people · 5 mentions · first linked 2010-09-09
- /strcmp_and_strlen_using_sse_4.24 people · 4 mentions · first linked 2010-10-13
- Implementing strcmp, strlen, and strstr using SSE 4.2 instructions (2008)3 people · 3 mentions · first linked 2016-09-01
- x86 Machine Code Statistics (2008)2 people · 3 mentions · first linked 2017-06-15
- Redundancy of x86 Machine Code (2009)2 people · 2 mentions · first linked 2018-01-24
- Programming books and sites2 people · 2 mentions · first linked 2011-11-15
What Hacker News says?
Writing an expression parser is probably the compiler "equivalent": http://www.strchr.com/expression_evaluator
Comment linking /expression_evaluator
on “Kernel 101 – Let’s write a Kernel”Submitted Implementing strcmp, strlen, and strstr using SSE 4.2 instructions (2008) as a story · 101 points
HN discussion> LLVM's libc++ Great find! So the library solutions are still often suboptimal, and it's even more easy to hide bad decisions in the C++ sources, so whoever has the approach "just use the default library" should be aware of that once the performance is important. Yes, even the simple multiplicative constants can significantly improve the hash if it by default doesn't do anything with the input! The libraries defini…
Comment linking /hash_functions
on “Fibonacci Hashing: The Optimization That the World Forgot”Submitted X86 Machine Code Statistics as a story · 60 points
HN discussionI tried to compile such list in past, see http://www.strchr.com/links
Comment linking /links
on “List of freely available programming books”Submitted Hash functions: An empirical comparison (2008) as a story · 48 points
HN discussionIt's possible that the difference is in the actual code: x86 machine code sometimes has multiple different encodings for the same assembler instruction. These would show up as single-byte differences in the binary. See http://www.strchr.com/machine_code_redundancy for some examples. Compilers might use this to stenographically hide additional data in the binary. Printer manufacturers already do something similar ( h…
Comment linking /machine_code_redundancy
on “How I compiled TrueCrypt 7.1a for Win32 and matched the official binaries”Submitted Redundancy of x86 Machine Code (2009) as a story · 46 points
HN discussionMore tests: http://www.strchr.com/hash_functions
Comment linking /hash_functions
on “Which hashing algorithm is best for uniqueness and speed?”Submitted Hash functions: An empirical comparison (2008) as a story · 34 points
HN discussionYes, speed for normal inputs is what's generally desired. A faster hash function can yield better overall performance than having fewer collisions. Here's some empirical evidence for this: https://www.strchr.com/hash_functions The speed is correlated only weakly with the number of collisions-- and using the modern x86 CRC32 instruction yields the best results.
Comment linking /hash_functions
on “How we broke PHP, hacked Pornhub and earned $20k”Submitted A complex data structure for predictive text input in Firefox OS as a story · 5 points
HN discussion> MurmurHash3 wasn't _designed_ with low collision rates in mind There is a difference between "low collision rate" and "collision resistance". Real-world data often contain regular patterns that can cause "bad" hash functions to give very non-random output, e.g. numbers at fixed intervals, pointers all aligned to 4k boundaries, or long strings that differ only by a short suffix. For instance, early versions of Java…
Comment linking /hash_functions
on “God: Scalable in Memory Data Structure Server in Go”Submitted Programming books and sites as a story · 3 points
HN discussionFor short strings, it basically doesn't help. For longer strings, it's a bit faster, it depends how bad what you were doing before was. Straight string comparison is not a great application for this in part because it's to intel's advantage to make string compare loops work fast without it. But you can be sure it speeds some customer's serious workload up significantly. That said, it all depends. It's great for "fig…
Comment linking /strcmp_and_strlen_using_sse_4.2
on “How the JVM compares strings on x86”Submitted x86 Machine Code Statistics (2008) as a story · 2 points
HN discussionI can't really answer that but your question reminded me of https://www.strchr.com/x86_machine_code_statistics Turns out that in practice a tiny number of instructions make up the vast majority of all used upcodes in a typical application (although it's not clear in this article how long the tail is, there could be hundreds of instruction in that "others" slice). My understanding is that there are many legacy instru…
Comment linking /x86_machine_code_statistics
on “Is the x86 Architecture Sustainable?”Submitted Implementing strcmp, strlen, and strstr using SSE 4.2 instructions as a story · 2 points
HN discussionAn implementation that uses image maps without scripts: http://www.strchr.com/share_buttons
Comment linking /share_buttons
on “Why to use Twitter, Facebook and Google Plus share links and not buttons”Submitted Hash functions: An empirical comparison as a story · 2 points
HN discussionA great resource for hash function performance: https://www.strchr.com/hash_functions It includes a bunch of more modern hash functions the author missed.
Comment linking /hash_functions
on “Brief Introduction To General Purpose Hash Functions”Submitted HTML5: new features and showcase examples as a story · 2 points
HN discussiondanluu knows much more about the subject matter than me. Meanwhile... If I take the main.cpp from http://www.strchr.com/media/crc32_popcnt.zip that he comparing and paste it into a new, default, VC2010 project. Then compile it as a Release build, then the mixed disassembly for the inner loop of POPCNT_HardwareSubbuN() looks like cnt += __popcnt(*(DWORD*)buf) + __popcnt(*(DWORD*)(buf + sizeof(DWORD) )) + __popcnt(*(D…
Comment linking /media/crc32_popcnt.zip
on “Hand-Coded Assembly Beats Intrinsics in Speed and Simplicity”Submitted Hash Functions: An Empirical Comparison as a story · 1 points
HN discussionAFAIK CRCs are not the fastest "hashes" you can get. Some non-cryptographic hashes outperform crcs by a large factor and provide longer checksums and much better statistical properties. E.g. see this: * https://www.strchr.com/hash_functions * https://jpountz.github.io/lz4-java/1.2.0/xxhash-benchmark/
Comment linking /hash_functions
on “Go Find Duplicates: A fast and simple tool to find duplicate files”Submitted Calculating day of week and Easter date as a story · 1 points
HN discussionGood homework is to implement an x86-64 mod/rm encoder. Quite a few corner cases. Sometimes you'll need to up-convert input parameters, because some combinations can't use 8-bit offset, for example, but require a 32-bit value. RSP can't use scaling, etc. There's also plenty of redundancy: https://www.strchr.com/machine_code_redundancy
Comment linking /machine_code_redundancy
on “X86 Addressing Under the Hood”Submitted Hash functions: An empirical comparison as a story · 1 points
HN discussionI found a clear explanation of the SIMD instructions here: http://www.strchr.com/strcmp_and_strlen_using_sse_4.2 . Apparently the instructions operate on strings up to 16 bytes in length.
Comment linking /strcmp_and_strlen_using_sse_4.2
on “Rejit - prototype of a non-backtracking, just-in-time, SIMD-able regexp compiler”Submitted Why there are no serious WP7 apps as a story · 1 points
HN discussion