On 10/31/14 4:50 PM, Jonathan Marler wrote:

I wrote a Windows CE app to run on our printers here at HP to test what
the Microsoft ARM compiler does with virtual function calls.  I had to
do an operation with a global volatile variable to prevent the compiler
from inlining the non-virtual function call but I finally got it to work.

Calling the function 100 million times yielded the following times:

Windows Compiler on ARM (Release)
-------------------------------------------
NonVirtual: 0.537000 seconds
Virtual   : 1.281000 seconds

Windows Compiler on x86 (Release)
-------------------------------------------
NonVirtual: 0.226000 seconds
Virtual   : 0.226000 seconds

Windows Compiler on x86 (Debug)
-------------------------------------------
NonVirtual: 2.940000 seconds
Virtual   : 3.204000 seconds


Here's the link to the code:

http://marler.info/virtualtest.c



Thanks, this is helpful.

-Steve

Reply via email to