Mark Payne created NIFI-14255:
---------------------------------

             Summary: SimpleRecordSchema.equals method is very slow
                 Key: NIFI-14255
                 URL: https://issues.apache.org/jira/browse/NIFI-14255
             Project: Apache NiFi
          Issue Type: Bug
          Components: Core Framework
            Reporter: Mark Payne
            Assignee: Mark Payne


The equals method for SimpleRecordSchema calls {{isRecursive()}} which is very 
slow. The method converts a List<RecordField> into a Stream, and then for each 
element calls DataType.isRecursive() which often does the same. Stream creation 
is very slow. This causes any {{Map<RecordSchema, ?>}} type of structure to be 
very slow.

We can re-implement to avoid any stream creation. In addition, once the 
{{isRecursive()}} method finishes its calculation, its value can be stored in a 
member variable. The value will not change unless its fields change. So we can 
just lazily initialize the member variable and clear it if fields are changed.



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

Reply via email to