Click here to Skip to main content
15,887,683 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralCross-Platform: dotnet core web api QR Codes Pin
raddevus30-Dec-19 10:00
mvaraddevus30-Dec-19 10:00 
PraiseRe: Cross-Platform: dotnet core web api QR Codes Pin
RickZeeland30-Dec-19 10:23
mveRickZeeland30-Dec-19 10:23 
GeneralRe: Cross-Platform: dotnet core web api QR Codes Pin
Brisingr Aerowing10-Jan-20 10:34
professionalBrisingr Aerowing10-Jan-20 10:34 
GeneralRe: Cross-Platform: dotnet core web api QR Codes Pin
raddevus10-Jan-20 11:04
mvaraddevus10-Jan-20 11:04 
GeneralHead, meet desk Pin
Richard Deeming20-Dec-19 3:25
mveRichard Deeming20-Dec-19 3:25 
GeneralRe: Head, meet desk Pin
Greg Utas20-Dec-19 4:47
professionalGreg Utas20-Dec-19 4:47 
GeneralRe: Head, meet desk Pin
ZurdoDev20-Dec-19 8:29
professionalZurdoDev20-Dec-19 8:29 
GeneralWeird Performance PinPopular
Rick York18-Dec-19 10:11
mveRick York18-Dec-19 10:11 
I am seeing an odd performance pattern that does entirely make sense to me. I am not asking for anything to be solved - just a confirmation of my observations, or not.

First, the background : I have tried a few options for a tracing library. Among them were Paul DiLascia's old TraceWin app and library. That worked pretty well and was the last one I used. It had a few drawbacks and the main was performance. I found it took on order of 6mS per message and that is just to slow for me and my app(s). I finally decided to write my own and it is looking really good. I now have overhead of about 3μS per message - yes, microseconds. This is where the weird part comes in.

That is the performance on my main development machine. It is a i9-9900X at 3.5Ghz and it runs W10. My testing machine is a Xeon i7-3820 at 3.6GHz and it runs W7, thank the heavens. The weird part is the Xeon has an overhead of less than 1μS per message, typically right at 0.9 and these numbers are quite repeatable.

My goal was to make this as low-overhead as possible and I think I have succeeded. Each message puts the message's text into a buffer (with sprintf) and then copies the buffer into a piece of shared memory using memcpy. However, first it acquires a mutex that guards access to the shared memory. I would not expect an i7 Xeon to be faster than an i9 Core-series processor at essentially the same clock rate at much of anything and certainly not three times faster. This leads to my main question : has anyone else seen this kind of performance difference accessing kernel-level OS objects between W7 and W10?

As I am writing this, I just thought of a possible explanation : clock throttling. I bet the i9 has its clock throttled back during this test. I will experiment a little and see if that's it.

-edit-

Upon further review, I think that is the explanation. In the task manager it shows the CPU idling at 1.2GHz and this would explain the performance difference. The test doesn't last long enough for the turbo mode to kick in so the CPU stays at its idle clock rate. Oh well.

I guess this means the trace library has a sub 1μ overhead and I am even happier about that. Yee haw.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"


modified 18-Dec-19 16:21pm.

GeneralRe: Weird Performance Pin
Nelek19-Dec-19 0:27
protectorNelek19-Dec-19 0:27 
GeneralRe: Weird Performance Pin
Rick York19-Dec-19 4:51
mveRick York19-Dec-19 4:51 
GeneralRe: Weird Performance Pin
Nelek19-Dec-19 8:38
protectorNelek19-Dec-19 8:38 
GeneralRe: Weird Performance Pin
Rick York20-Dec-19 8:13
mveRick York20-Dec-19 8:13 
GeneralRe: Weird Performance Pin
Nelek20-Dec-19 8:44
protectorNelek20-Dec-19 8:44 
GeneralHow many values between 0 and 0? Pin
raddevus16-Dec-19 5:59
mvaraddevus16-Dec-19 5:59 
GeneralRe: How many values between 0 and 0? Pin
Richard Deeming16-Dec-19 8:49
mveRichard Deeming16-Dec-19 8:49 
GeneralRe: How many values between 0 and 0? Pin
raddevus16-Dec-19 8:58
mvaraddevus16-Dec-19 8:58 
GeneralRe: How many values between 0 and 0? Pin
TheGreatAndPowerfulOz16-Dec-19 9:05
TheGreatAndPowerfulOz16-Dec-19 9:05 
GeneralRe: How many values between 0 and 0? Pin
raddevus16-Dec-19 9:21
mvaraddevus16-Dec-19 9:21 
GeneralRe: How many values between 0 and 0? Pin
TheGreatAndPowerfulOz16-Dec-19 10:05
TheGreatAndPowerfulOz16-Dec-19 10:05 
GeneralRe: How many values between 0 and 0? Pin
raddevus16-Dec-19 10:16
mvaraddevus16-Dec-19 10:16 
GeneralRe: How many values between 0 and 0? Pin
Richard Deeming17-Dec-19 0:28
mveRichard Deeming17-Dec-19 0:28 
GeneralRe: How many values between 0 and 0? Pin
TheGreatAndPowerfulOz17-Dec-19 5:05
TheGreatAndPowerfulOz17-Dec-19 5:05 
GeneralRe: How many values between 0 and 0? Pin
TheGreatAndPowerfulOz16-Dec-19 9:02
TheGreatAndPowerfulOz16-Dec-19 9:02 
GeneralRe: How many values between 0 and 0? Pin
raddevus16-Dec-19 9:10
mvaraddevus16-Dec-19 9:10 
GeneralRe: How many values between 0 and 0? Pin
TheGreatAndPowerfulOz16-Dec-19 10:07
TheGreatAndPowerfulOz16-Dec-19 10:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.