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

Fix EnsureLargeEnoughWaveSimple for any index #355

Closed Garados007 closed 1 year ago

Garados007 commented 1 year ago

The old implementation does only increase the size of the wave one time if the requested index is outside the capacity of the wave. This is okay for smaller indexes but will return a too small wave if the requested index is way larger than the current capacity of the wave.

This fixes the implementation in that way that it always calculates the next suitable size that fits the requested index and resizes the wave to always fit the requested index. This also includes a special logic to use exponential growth with better asymptotical behavior for smaller wave sizes and linear growth if the wave has a size that could have a large impact on system memory.

With this EnsureLargeEnoughWaveSimple can no longer considered as "simple" but the name is kept for compability. The documentation has been updated.