Skip to content

Efficiency hacks #492

@NSoiffer

Description

@NSoiffer

I tried a few things that supposedly will help speed up the code:

  1. Added #[inline] to functions that "cursor" thought would help.
  2. Changed phf::Set<char> to use match. This supposedly converts the hash tables to jump tables which is more efficient.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions