Julian Hyde created CALCITE-3517:
------------------------------------

             Summary: DiffRepository spends too much time writing XML, makes 
some tests 5x slower
                 Key: CALCITE-3517
                 URL: https://issues.apache.org/jira/browse/CALCITE-3517
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde


Tests that use {{DiffRepository}} are spending far too much effort writing XML, 
even if the XML matches the reference file. For example, If I comment out [a 
call to set(tag, 
next)|https://github.com/apache/calcite/blob/ee83efd360793ef4201f4cdfc2af8d837b76ca69/core/src/test/java/org/apache/calcite/test/DiffRepository.java#L267],
 {{RelOptRulesTest}} improves from 32s to 6s; {{SqlToRelConverterTest}} 
improves from 24s to 4.7s; {{SqlPrettyWriterTest}} remains .8s.

The {{DiffRepository.expand}} method is the cause of the inefficiency. It 
causes the entire XML document to be re-generated and written to disk. This is 
not just slow but quadratic - if a test has N cases, each test writes the XML 
document, an effort proportional to N.

{{DiffRepository}} should remain conservative. If one of the tests fails, and a 
later test crashes, the output from the failed test should have been written 
out. It is acceptable if the test remains slow if there are test failures.

{{DiffRepository}} is only used in tests; this bug does not affect production 
code.



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

Reply via email to