Sysnative BSOD Apps - Suggestion (Performance)

AceInfinity

Emeritus, Contributor
Joined
Feb 21, 2012
Posts
1,728
Location
Canada
I have a suggestion that I think is probably beneficial in this case. Most common, for the speed of the apps, but this comes with a few other benefits too. Unless you really take an inside look at writhziden's apps though you probably wouldn't notice it unless your computer hardware is really junky.

Since you're still using .NET, your assembly is compiled down to MSIL. This means that every time you run the program, it has to be recompiled by the JIT compiler (at runtime). Microsoft has a utility where you may pre-compile the assembly into a native image, where the processor itself can understand these instructions itself without having to go through the JIT compiler firsthand, and this native image goes into the native image cache.

The utility i'm talking about is NGEN (ngen.exe).

A few advantages of using NGEN include, reduced memory footprint by reducing the private memory pages used by the aplication (obviously in which would also have a good impact on system-wide memory), and faster application load time. Among other benefits, these are probably going to be the most applicable.

edit: writhziden you're not using a lot of try statements are you? :confused2:

~AceInfinity
 
Last edited:
I have a suggestion that I think is probably beneficial in this case. Most common, for the speed of the apps, but this comes with a few other benefits too. Unless you really take an inside look at writhziden's apps though you probably wouldn't notice it unless your computer hardware is really junky.

Since you're still using .NET, your assembly is compiled down to MSIL. This means that every time you run the program, it has to be recompiled by the JIT compiler (at runtime). Microsoft has a utility where you may pre-compile the assembly into a native image, where the processor itself can understand these instructions itself without having to go through the JIT compiler firsthand, and this native image goes into the native image cache.

Doing some cursory reading on this, I am confused as to whether this is something I am supposed to do during compiling the apps or something you are suggesting users of the apps should do... If it is something I need to do, is there a better resource than the rather confusing MSDN site? I feel like Microsoft programmers who write information at MSDN do so assuming the software developers know a lot about Windows based programming. I know a lot about Linux based C++ programming, so I am often lost when trying to determine what Microsoft developers are talking about...


EDIT:
Looking further into this, I would need to build the Ngen.exe interface into an installer. I have no option to do this with Visual Studio 2010 free edition, and I am not paying money to make the apps start faster. If you can provide a more feasible, free alternative, that would be great.

One thing I can provide is an Ngen.exe setup utility to select the version of the apps to optimize.​


The utility i'm talking about is NGEN (ngen.exe).

A few advantages of using NGEN include, reduced memory footprint by reducing the private memory pages used by the aplication (obviously in which would also have a good impact on system-wide memory), and faster application load time. Among other benefits, these are probably going to be the most applicable.

edit: writhziden you're not using a lot of try statements are you? :confused2:

~AceInfinity

No, I am not using a lot of try statements. I am using a lot of if statements, which is probably almost as bad or equally as bad in terms of causing a bottleneck. The main processing application itself has very little of this beyond the initialization routines for setting up directories and getting user options.
 
Last edited:
Well, you could have a VBS script handed out with installation instructions I suppose for both adding and removing the native image from the cache for any user using your application (label the step as optional I guess). They would otherwise need to know how to use NGEN. I have the Ultimate version of Visual Studio, before 2010, but now i'm using 2012. I have not checked, but perhaps there would be a dll out there which would be the wrapper for NGEN kind of like PEVerify? I'd be curious myself to see what there is for NGEN.

I was just asking about the try statements though, mostly because of a couple things, specified below:

- Your debugging time for finding bugs to the app is going to be significantly more difficult, and more of a hairpulling event, than a fixing event. Errors are great to look at, and you're probably getting nothing where you should be seeing certain errors in order to try and fix the issue at it's base. This reduces the efficiency of your debugging as well for that reason.
- It will significantly reduce the performance of your apps if you're not dealing with exceptions properly. Having exceptions thrown and ignored at runtime enough times will negatively impact the overall experience the end-user has with your app, comparative to if you were to check for the exceptions yourself instead of allowing the exceptions to decide what your app does next.

I was fooling around with various .NET utilities, and tried to decompile your app back to MSIL, which works, but not sure if the conversion from VC++ over to C#, VB.NET would have added those, MSIL would be most accurate anyways... Would have caused those changes. I'm seeing lots of indentations after indentations of try statements lol. I only checked DmpList though.
 
Last edited:
I may create a setup.exe myself that does what I want. I have already spent hours trying to figure this out with no real progress made, and I cannot afford to shell out $3000+ for Visual Studio pro or ultimate just to make apps better that I am not being paid to develop. I have tried some free software, and so far, nothing works as expected. I feel it might be easier to create my own. Within it can be a run of the Ngen installer I have found by John Grove with changes to make it work with .NET Framework 4.0 and to only initialize the SysnativeBSODApps...

As to the try statements, that is odd. Perhaps an implementation by Visual Studio C++ 2010 with the forms object I added for that particular window.
 
I have VS 2012 Ultimate though, it doesn't really give me much more, but the easiest thing to do would be to create a small standalone script to work for this. ngen.exe comes with the Windows SDKs, so anybody could grab it if they want.

Along with providing maybe a link to where people can download ngen if they want. For your app, I think it would result in noticeable improvements though.
 
Last edited:
I had a question: Since the apps are intended to be moved to any location, will copying them elsewhere negate ngen.exe's installation?
 
I had a question: Since the apps are intended to be moved to any location, will copying them elsewhere negate ngen.exe's installation?

Not unless it's moved off the local machine. I believe the unique assembly name as an ID is given to the native image cache when you use ngen to install a native image to the local machine, and this is validated or checked for when the application is loaded.

For your apps though it saves me 0.9Mb of memory (before the app does anything) if I was using ngen. It's 4.7Mb at runtime just after starting your app (with native code cached in the native image cache), and 5.6Mb without having a native image in the cache just after application load.
 
Last edited:
Thanks. I'll continue developing my installer for the program. Should help users to install the apps and have faster startup via the ngen optimization. :-}
 
Very nice :) I'm curious to see how noticeable it would be for others as well if they were to test. Running on different hardware, Operating systems, etc...
 
Yeah, I don't see much difference on my own systems with the ngen.exe compiler...

I just released an official update for the apps so now users can be notified when an update is available rather than getting the typical message each month that an update may be available.

I still have the same phrasing that an update may be available since that message can show up if internet is missing and the cache is cleared.
 
Yeah, I don't see much difference on my own systems with the ngen.exe compiler...

I just released an official update for the apps so now users can be notified when an update is available rather than getting the typical message each month that an update may be available.

I still have the same phrasing that an update may be available since that message can show up if internet is missing and the cache is cleared.

Memory? Application load time?
 
Windows 8 - 12 GB, ~1 second both cold and warm loads.

Windows XP (VirtualBox) - 3 GB, 10 seconds cold load, 5 seconds warm load.
 
Last edited:
Curiosity question, please -

Not that it's a problem, but why does the app run ~ 50% CPU? (Intel P7350 Core2Duo here, so I assume it's really ~100% CPU, i.e., one of my 2 CPU cores..?)
 
Last edited:
Too many threads for multi-tasking, or a really intensive task is going on. Does it run at 50% the whole time, or just when you're scanning dump files?
 
I'd have to double-check, but as I recall, ProcExp shows the BSOD app as parent with KD & CMD as children; total CPU utilization is always upper 40% - usually just below 50%
 
Sounds accurate with the parent and children processes, but the CPU percentages, which seem a bit extreme. I wonder what the apps would be doing to be using that much of the processors resources ? :confused2:
 
It has always been like that.

I'll have to fire up Camtasia Studio and record ProcExp.
 
Camtasia didn't come out se well (don't understand "rendering" very well; but it is KD that utilizes CPU from single digits to 40%+.
 

Has Sysnative Forums helped you? Please consider donating to help us support the site!

Back
Top