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

Gleb Kanterov updated BEAM-10631:
---------------------------------
    Description: 
Schema#indexOf is broken between 2.21.0 and 2.23.0 (can't tag 2.23.0 yet).

The regression was introduced in 
[apache/beam#10413|https://github.com/apache/beam/pull/10413/files#r464824602]. 

{code:diff}
-    if (index == null) {
-      throw new IllegalArgumentException(
-          String.format("Cannot find field %s in schema %s", fieldName, this));
-    }
+    Preconditions.checkArgument(
+        index != null, String.format("Cannot find field %s in schema %s", 
fieldName, this));
{code}

`Schema.indexOf` is on a critical path, and calling `this.toString()` was 
allocating a lot of small objects, that scaled badly with a number of fields 
and options in schema. That wasn't significantly noticeable in benchmarks that 
used schemas with few fields.

  was:Schema#indexOf is broken between 2.19.0 and 2.22.0


> Performance of Schema#indexOf is broken
> ---------------------------------------
>
>                 Key: BEAM-10631
>                 URL: https://issues.apache.org/jira/browse/BEAM-10631
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>    Affects Versions: 2.21.0, 2.22.0
>            Reporter: Gleb Kanterov
>            Assignee: Gleb Kanterov
>            Priority: P1
>             Fix For: 2.24.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Schema#indexOf is broken between 2.21.0 and 2.23.0 (can't tag 2.23.0 yet).
> The regression was introduced in 
> [apache/beam#10413|https://github.com/apache/beam/pull/10413/files#r464824602].
>  
> {code:diff}
> -    if (index == null) {
> -      throw new IllegalArgumentException(
> -          String.format("Cannot find field %s in schema %s", fieldName, 
> this));
> -    }
> +    Preconditions.checkArgument(
> +        index != null, String.format("Cannot find field %s in schema %s", 
> fieldName, this));
> {code}
> `Schema.indexOf` is on a critical path, and calling `this.toString()` was 
> allocating a lot of small objects, that scaled badly with a number of fields 
> and options in schema. That wasn't significantly noticeable in benchmarks 
> that used schemas with few fields.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to