Skip to content

Suggested Performance Improvements #67

@smarr

Description

@smarr

From @sillycross:

  1. Use upvalue instead of heap-allocated frames. Many benchmarks have a lot of function calls, and even more without IC for trivial methods (I can give you numbers if you want, since DSOM has a function frequency profiling feature). The cost of heap-allocated frames are enormous.
  2. Implement a real IC for method lookup.
  3. Use a cuckoo hash table that contains all the methods in a class (including parent classes) for faster method lookup on IC miss (see https://github.com/sillycross/dsom/blob/4cfd415fd1f27b1302b1067099e464ce7eaca33a/runtime/som_class.h#L7. The memory overhead is negligble since there are just so many classes and so many methods, but it makes your IC miss path much faster. If your interpreter has polymorphic IC this shouldn't matter too much, since your IC will hit anyway (based on your analysis of AWFY workload, I didn't verify), but if your interpreter has monomorphic IC there's going to be a lot of misses so the speed of the miss path would matter (again, that's based on the analysis you did).
  4. Implement specialized fast paths for common methods.
  5. Implement IC for trivial methods.
  6. Get rid of the virtual function calls. Currently there are virtual functions everywhere (e.g., VMInvokable). Plain function pointers are faster than virtual functions, and this matters (virtual call is a load followed by a call, and dependent memory access is the worst enemy of performance).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions