[ 
https://issues.apache.org/jira/browse/CASSANDRA-21612?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Semb Wever updated CASSANDRA-21612:
-------------------------------------------
    Test and Documentation Plan: ci
                         Status: Patch Available  (was: Open)

> Compile the sstable component type patterns once
> ------------------------------------------------
>
>                 Key: CASSANDRA-21612
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21612
>             Project: Apache Cassandra
>          Issue Type: Improvement
>          Components: Local/SSTable
>            Reporter: Michael Semb Wever
>            Assignee: Michael Semb Wever
>            Priority: Normal
>             Fix For: 6.0.x, 7.x
>
>
> {{Component.Type.fromRepresentation}} walks every registered type and calls 
> {{Pattern.matches}}:
> {code:java}
> for (Type type : Type.all)
> {
>     if (type.repr != null && Pattern.matches(type.repr, repr) && 
> type.formatClass.isAssignableFrom(format.getClass()))
>         return type;
> }
> {code}
> {{Pattern.matches}} compiles its regular expression on every call, so each 
> filename parsed compiles up to a dozen patterns. {{Component.parse}} runs for 
> every component file the node lists, which makes startup and every sstable 
> directory scan pay the cost.
> The patch compiles the pattern once in the {{Type}} constructor and matches 
> against the compiled pattern. Behaviour is unchanged.
> Patch: 
> [mck/upstream/component-type-pattern/trunk|https://github.com/thelastpickle/cassandra/tree/mck/upstream/component-type-pattern/trunk]
> Provenance: 
> [8f54f6ad93|https://github.com/datastax/cassandra/commit/8f54f6ad93ac3470e0eeff694575c08403cd972a]
>  by Kamil Leśniak



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to