Skip to content

Huge CPU performance loss when using cvm::position_distance #911

@HanatoK

Description

@HanatoK

Describe the bug
When calling cvm::position_distance, it has to call a virtual function from the proxy, which introduces huge CPU performance penalty. In my initial tests with selfCoordNum,

  • With manually inline the logic of cvm::position_distance into compute_pair_coordnum, the simulation speed is about 89 ns/day;
  • With the current code using virtual function for cvm::position_distance, the simulation speed is about 67.2 ns/day;
    In other words, the performance loss of using virtual function in cvm::position_distance is about 22%.

Back-end (i.e. package that uses Colvars)
All

Colvars version
All

Expected behavior
Colvars should be refactored to provide is own function for wrapping, and this wrapping function should be able for compilers to inline.

Output log
N/A

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