Skip to content

Casing is slow and computationally expensive. #1511

@ForkingFrenzy

Description

@ForkingFrenzy

A note for the community

No response

Problem

The casing functions in vrl are a bit slow.

. =  map_keys(., recursive: true) -> |key| { snakecase(key) }

The above code is equivalent to the code below using upcase in terms of performance.

Low: 0.1ms, High: 0.4ms
I tested using vector playground site. I understand that this method isn't the most accurate in terms of performance but the point I am trying to make is that it doesn't have to be accurate to realize that the casing functions are unoptimized.

. = map_keys(., true) -> |key| { upcase(key) }
. = map_keys(., true) -> |key| { upcase(key) }
. = map_keys(., true) -> |key| { upcase(key) }
. = map_keys(., true) -> |key| { upcase(key) }
. = map_keys(., true) -> |key| { upcase(key) }
. = map_keys(., true) -> |key| { upcase(key) }
. = map_keys(., true) -> |key| { upcase(key) }
. = map_keys(., true) -> |key| { upcase(key) }
. = map_keys(., true) -> |key| { upcase(key) }
. = map_keys(., true) -> |key| { upcase(key) }

VRL Program


VRL and/or Vector Version

a5706e8

Debug Output


Example

No response

Additional Context

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: more infoNeeds more info from author. Issue is missing a VRL program, a reproduction step or benchmarks.type: bugA code related bugvrl: stdlibChanges to the standard library

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions