Skip to content

Override of is_a? causes degraded performance #23

@thallgren

Description

@thallgren

The method RGen::MetamodelBuilder::BuilderRuntime#is_a? is currently where the CPU spends most of its time in some of our performance tests. I understand the need for overriding this very basic method to see the ClassModule type inheritance but perhaps there is less intrusive approach than to actually change the is_a? contract?

An alternative that I've experimented with is to implement a specific eIsA? method and then call that method instead when the ClassModule inheritance is relevant. In my experiment I changed the BuilderExtensions.type_check_code slightly so that it tests for eIsA? when the value is an MMBase but use is_a? when it's not. All tests are still green after changing 'test_inheritance' unit test to also use eIsA?. Our own performance tests show a significant improvement.

There are probably more places that needs changing in the Rgen code base (and more tests to write) and I'd be happy to submit a PR for this but I'd like to discuss it first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions