Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@D-4got10-01 I'm optimizing it a little more before pushing it
Then you can benchmark it yourself :P -
I've noticed rust always runs faster on your machine than others' machines
the benchmarks don't line up with others -
@jestdotty Run it for yourself. I'm doing the normal `make benchmark_only`. No funny business
-
@Tounai I think it's mostly two things:
* loops written more low level to optimize codegen
* /way/ quicker forbidden word check
Threads also play a role, and I have no idea why rayon is so damn fast, even faster than manual threads pinned to cores
But I think the forbidden word checker is what really makes it slow. Apart from @jestdotty who uses a trie, the other versions just do a linear search through the list of ~30 words
I use lexicographically sorted word sublists for each starting char and also store a bitmap of contained string lengths
So to check whether a string is in the list you look up whether that starting char even has entries, if it does then whether your word length is in the list and then I iterate over the sorted list. If a char value is bigger/smaller I can immediately move to the next string or cancel the search
Been working on my Rust isspam version and now it's looking like it should again :P
Rust back on top, baby (☞⌐▀͡ ͜ʖ͡▀ )☞
***benchmarking***
Time C: 0.836021900177002
Time Rust: 0.12235116958618164
Time CPP: 0.39263033866882324
Time Borded CPP: 0.6284189224243164
Time Jest Rust: 0.27682042121887207
***end benchmark***
rant