This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is another mmap based topfew solution. | |
// context: https://www.tbray.org/ongoing/When/202x/2020/07/01/More-Topfew-Fun. | |
// other than the static hashmap, it doesn't use dynamic memory. | |
// rather than dynamically allocating strings for the hash keys, | |
// it just keeps pointers to the mmap'd data. | |
// it reparses the fields whenever it wants to compare two hash entries. | |
// compile like this: gcc -O2 topfew.c | |
// the following should be cmdline arguments | |
// but for the demo's simplicity let's just hardcode them: |