Today I ported my old memory benchmark
from Borland C++ builder 5.0 to BDS2006 Turbo C++ and found out weird thing.
- exe from BCB5 runs OK and stable
- exe from BDS2006 measure OK only before main Form is started (inside its constructor) and if the benchmark is started again after main form is
Activated
or even after any VCL component change (for example Caption
of main form) then the speed of benchmark thread is strongly affected.
After some research I found out that:
- Does not mater if test is inside thread or not.
- The process/thread priority,affinity does not affect this either.
- Hide of any window (
Visibility,Enabled
) does not affect this.
- call the test form
OnIdleEvent
does not affect this
- does not mater if time is measured by
RDTSC
or PerformanceCounter
My conclusion is that VCL library runs some code/thread on the background so my questions are:
Is there a way to temporarily pause VCL code/stuff ?
ideal something like Application->Pause();
and Application->Resume();
or just Forms
.
what else could cause this behavior and how to avoid it ?
PS.
Test application has no VCL components other than main form. Benchmark is just a few memory transfers by rep stosd
with different block sizes (no funny stuff). Source is in this related Q/A. I know BDS2006 is out-dated but I am not looking for upgrade right now so please skip any comments about that they are not help-full at all.
Tested on Windows7 pro x64, 32bit
Application
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…