byte-physics / igortest

Igor Pro Universal Testing Framework
https://docs.byte-physics.de/igor-unit-testing-framework/
BSD 3-Clause "New" or "Revised" License
7 stars 2 forks source link

Perf: EQUAL_WAVE_WRAPPER generates the msg string for each mode and evaluates the result afterwards #474

Closed MichaelHuth closed 3 months ago

MichaelHuth commented 3 months ago

The check for CHECK_EQUAL_WAVES is slow because we generate the detailed message before we evaluate the result.

Look into that, if the performance can be increased by not creating output strings that are not output in the end.

Garados007 commented 3 months ago

Looking into the code it doesn't seem we create detailed reports before evaluating the result. Yes, we combine some strings but not the whole report.

The function CHECK_EQUAL_WAVES calls IUTF_Wrapper#EQUAL_WAVE_WRAPPER. The second function does some checks with the provided arguments (like tolerances and comparison modes). The detailed comparison is done in IUTF_Checks#AreWavesEqual, which does a basic EqualWaves first and only in case of a mismatch a detailed report is generated.

Yes, IUTF_Wrapper#EQUAL_WAVE_WRAPPER does some additional stuff like fetching wave names or combining the empty details into an error message, which is not required if we have no error. And I think this is the only thing that can be improved.

t-b commented 3 months ago

The code at https://github.com/byte-physics/igortest/blob/33200cf27241cf94ff1013c3c59f362bbb62af0b/procedures/igortest-assertion-wrappers.ipf#L799-L805

takes some time as GetWaveNameInDFStr is expensive.

For this case it could be as easy as moving the message generation into AreWavesEqual.

Garados007 commented 3 months ago

I don't think there is a need to move these lines into another function. We can just wrap them in an if-statement that checks result and only calls the expensive functions when needed.