Teigha BIM: Measuring Performance and Memory Allocation

Ivan Shulga

May 11, 2017

Teigha BIM has a test, TB_PerfTest, that measures performance and memory consumption.
Performance can be measured in four modes:
• Reading
• Writing
• Rendering
• Rendering and writing

And the following types of memory allocation data are measured: • WorkingSetSize
• PagefileUsage
• PeakWorkingSetUsage
• PeakPagefileUsage
• PagefileUsageReleased
• PagefileUsageDecreased

The syntax of the command is:
>TB_PerfTest <source file> <TEST NAME> <NumOfIter> [ST|MT|MT2|MT4|MT8|MT16] [PL]

[ST|MT|MT2|MT4|MT8|MT16] - multithread mode: all logical CPU's|2|4|8|16. ST means single-thread
[PL] - use partial-loading mode

For example:
TB_PerfTest.exe "C:\sample.rvt" READ 3 ST

This example makes three iterations of the “reading” test in a single-thread with the sample file “C:\sample.rvt”.
Measuring performance
As described previously, there are four modes of measurement:
1) Reading (“READ”) — Measures duration of file loading (from disk).
2) Write (“WRITE”) — Measures duration of file saving to a dummy stream.
3) Rendering (“RENDER”) — Measures duration of file rendering (to a bitmap file).
4) Rendering and writing (“RENDER_SAVE”) — Measures the sum of durations of the rendering and saving process.

At the end of all iterations, the tool calculates the average value of duration. Note that the first measurement has no effect on the result because usually the first measurement has a large error. So the average duration is:
AverageDuration = SUM(duration_2, … duration_N)/(N-1);

Measuring memory allocation
The main purpose of memory allocation measurement is to find the maximum memory allocation for file loading in order to detect non-optimal containers and allocations in various cases. It is also possible to detect memory leaks if memory usage increases from iteration to iteration.