C++/CLI the fastest compiler? Yes, at least for me. :-)

A

Ajay Kalra

This is very useful info. It was causing confusion given mixed
information coming from MSFT itself.
 
W

Willy Denoyette [MVP]

"Carl Daniel [VC++ MVP]" <[email protected]>
wrote in message | | > Followup.
| > !!! Stopwatch.Elapsed.Ticks != Stopwatch.ElapsedTicks !!!
|
| A ha! I obviously hadn't looked at the code closely enough to realize
that
| it was using Elapsed.Ticks and not ElapsedTicks.
|
| > One should not use Elapsed.Ticks to calculate the elapsed time in
| > nanoseconds.
|
| True - one should use it to calculate the elapsed time in 0.1us units,
since
| that's what TimeSpan.Ticks is expressed as.
|
| > The only correct way to get this high precision count is by using
| > Stopwatch.ElapsedTicks like this:
| >
| > long nanosecPerTick = (1000L*1000L*1000L) / Stopwatch.Frequency;
|
| but make this a double. Stopwatch.Frequency is more than 1E9 on modern
| machines using the MP HAL.
|
| double nanosecPerTick = 1000.0 * 1000L * 1000L / Stopwatch.Frequency;
|


Sure, or use picoseconds :)

long picosecPerTick = 1000L * 1000L * 1000L * 1000L / Stopwatch.Frequency;

90614831400 picoseconds
Looks real crazy isn't it?


Willy.
 
W

Willy Denoyette [MVP]

| This is very useful info. It was causing confusion given mixed
| information coming from MSFT itself.
|
| --------
| Ajay Kalra
| (e-mail address removed)
|

Well, the C++/CLI team did not want to generate explicit sequence points in
the IL, so the JIT compiler can only rely on the implicit sequence points
(that is when the evaluation stack is empty). That means also that it's not
possible to synchronise the IL with the actual code while debugging C++/CLI
in managed mode and you need the PDB to set breakpoint in your code, not a
big deal IMO.


Willy.
 
C

Carl Daniel [VC++ MVP]

Willy Denoyette said:
Sure, or use picoseconds :)

Nah - that's short sighted. Let's standardize on Attoseconds :)

long attosecPerTick = 1000L * 1000L * 1000L * 1000L * 1000L * 1000L
/Stopwatch.Frequency;

now that's just getting silly... for the next few decades at least.

-cd
 
W

Willy Denoyette [MVP]

"Carl Daniel [VC++ MVP]" <[email protected]>
wrote in message | | > Sure, or use picoseconds :)
|
| Nah - that's short sighted. Let's standardize on Attoseconds :)
|
| long attosecPerTick = 1000L * 1000L * 1000L * 1000L * 1000L * 1000L
| /Stopwatch.Frequency;
|
| now that's just getting silly... for the next few decades at least.
|
| -cd
|
|

LOL, I'll keep it in mind for a next life maybe :)

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top