Skip to content

Improve performance: eliminate non-precompiled Regex string patterns #26914

@adaslaf

Description

@adaslaf

There are still a few places in the "project production" java files where precompiled Regexps are not used.
For example, some calls to the String#replaceAll and String#replaceFirst methods.
Trino code examples:

name.replaceAll("[^A-Za-z0-9_$]", "_");
metadataLocation.replaceFirst("/metadata/[^/]*$", "");

We can avoid that by explicitly using a Pattern object.
More info:
https://stackoverflow.com/a/6262439

The performance increase will probably be minimal, but... it's still something ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions