Skip to content

Performance degradation when using field_name_type with Symbol.alias_method(:to_s, :name) #730

Description

@p8

I maintain the Ruby frameworks on the https://www.http-arena.com/ benchmarks.

For the Roda tests I've set field_name_type = :symbol to get a 10% performance increase for RPS for the database test (async-db).

After reading https://bugs.ruby-lang.org/issues/22137, I changed the Roda test to let Symbol#to_s return a frozen string by using:

Symbol.alias_method(:to_s, :name)

This resulted in a 57% performance decrease for RPS, for the database test.
I didn't expect this change to have a large impact the database calls.

Reverting the field_name_type = :symbol change resulted in a 108% performance increase for RPS.
This was even more unexpected.

I'm not sure if this is just a issue with the HttpArena tests or a known issue, but I found it interesting enough to share.
Feel free to close this is issue if this isn't something that can or should be fixed.

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