I tried a few things that supposedly will help speed up the code:
- Added
#[inline] to functions that "cursor" thought would help.
- Changed
phf::Set<char> to use match. This supposedly converts the hash tables to jump tables which is more efficient.
- Changed some
phf::Set<str> to use match. The ones changed were short ones and ones that has just one or two chars (chem elements).
Overall, it was not successful:
- Inlining added about 5%.
phf::Set<char> didn't change the time significantly
phf::Set<str> added about 3%,
Note: these were based on loops of size 5000, run 4-5. I noticed that sometimes there was a big jump in time (20%). This probably happened due to running on a slower core. I excluded those times from averages.
Note: three different AIs recommended these changes...
It is probably time to profile the code -- that's where real efficiencies can be found. From these experiments, I don't see any big drop offs in efficiency. I have a new fast machine now, The code is taking about 2.2ms to get speech and braille.