countwords
adix
countwords | adix | |
---|---|---|
5 | 4 | |
4 | 38 | |
- | - | |
2.6 | 7.2 | |
6 months ago | 11 days ago | |
Rust | Nim | |
MIT License | ISC License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
countwords
- Are there benchmark results of current Forth implementations (interpreted & compiled)?
-
Open any file as bytes
See an example: https://github.com/kimono-koans/countwords/blob/master/rust/fast-simple/main.rs
-
I/O is no longer the bottleneck
this is truly 1978 all over again. No flame graphs, no hardware counters no bottleneck analysis. Using these 'optimizations' for job interviews is questionable at best.
[1] https://benhoyt.com/writings/count-words/
-
Correct name for word matching problem
This might actually be interesting to you: https://benhoyt.com/writings/count-words/
-
Performance comparison: counting words in Python, C/C++, Awk, Rust, and more
In case anyone is interested, I did an optimized, but much more simple, Rust implementation just today[0], which is faster than the optimized implementation on my machine. No indexing into arrays of bytes, etc., no "code golf" measures.
Looks like idiomatic Rust, which I think is interesting. Shows there is more than one way to skin a cat.
[0]: https://github.com/kimono-koans/countwords/blob/master/rust/...
adix
-
I/O is no longer the bottleneck
Note: Just concatenating the bibles keeps your hash map artificially small...which matters because as you correctly note the big deal is if you can fit the histogram in the L2 cache as noted elsewhere and this really matters if you go parallel where N CPUsL2 caches can speed things up a lot -- until* your histograms blow out CPU-private L2 cache sizes. https://github.com/c-blake/adix/blob/master/tests/wf.nim (or a port to your favorite lang) might make it easy to play with these ideas.
-
A Cost Model for Nim
which is notably logarithmic - not unlike a B-Tree.
When these expectations are exceeded you can at least detect a DoS attack. If you wait until such are seen, you can activate a "more random" mitigation on the fly at about the same cost as "the next resize/re-org/whatnot".
All you need to do is instrument your search to track the depth. There is some example such strategy in Nim at https://github.com/c-blake/adix for simple Robin-Hood Linear Probed tables.
-
Performance comparison: counting words in Python, Go, C++, C, Awk, Forth, Rust
Knuth-McIlroy comes up a lot. Previous discussion [1]. For this example I can make a Nim program run almost exactly the same speed as `wc -w`, yet the optimized C program runs 1.2x faster not 3.34x slower - a whopping 4x discrepancy - much bigger than many of the ratios in the table. So, people should be very cautious about conclusions from any of this.
[1] https://news.ycombinator.com/item?id=24817594
[2] https://github.com/c-blake/adix/blob/master/tests/wf.nim
What are some alternatives?
gccontent-benchmark - Benchmarking different languages for a simple bioinformatics task (Counting the GC fraction of DNA in a FASTA file)
countwords - Playing with counting word frequencies (and performance) in various languages.
RAMCloud - **No Longer Maintained** Official RAMCloud repo
countwords - Playing with counting word frequencies (and performance) in various languages.
wordcount - Counting words in different programming languages.
robin-hood-hashing - Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20
KindleClippingsTranslator - Czytacz slowek
huniq - Filter out duplicates on the command line. Replacement for `sort | uniq` optimized for speed (10x faster) when sorting is not needed.
tiny_sqlite - A thin SQLite wrapper for Nim
countwords - Playing with counting word frequencies (and performance) in various languages.
word_frequency_nim - The word frequency program, written in simple nim.