xsharp.eu • Native image generation
Page 1 of 1

Native image generation

Posted: Fri Feb 23, 2024 1:31 pm
by ArneOrtlinghaus
The program DBForge Studio Installation makes a "Native image Generation" and recommends it's usage to have performance advantages. The process took at least a minute on a quite fast development machine where many files were procecessed.

I have googled and found for example the article about the Microsoft Tool NGen

https://learn.microsoft.com/en-us/dotne ... -generator

I ask me now if it is worth to do this process and why there is a difference to the automatic compilation process the JIT compiler normally does the first time.

Arne

Re: Native image generation

Posted: Fri Feb 23, 2024 1:46 pm
by wriedmann
Hi Arne,
if I remember correctly, this is executed in the installation process on the X# compiler.
Wolfgang

Re: Native image generation

Posted: Fri Feb 23, 2024 2:09 pm
by robert
Wolfgang,
wriedmann wrote: Fri Feb 23, 2024 1:46 pm Hi Arne,
if I remember correctly, this is executed in the installation process on the X# compiler.
Wolfgang
That is true. See the "c:\Program Files (x86)\XSharp\Uninst" folder.
There is an instngen.cmd file that does this and an uninstngen.cmd that removes the native images when uninstalling.

Robert

Re: Native image generation

Posted: Wed Feb 28, 2024 9:10 am
by VR
NGen helps to reduce the start time of the application. Here's a blogpost from microsoft and a tutorial from devexpress:

https://devblogs.microsoft.com/dotnet/a ... rformance/
https://docs.devexpress.com/GeneralInfo ... aunch-time

The annoying part of NGen is, that it has to be done on every pc, every time an update of the application is installed.

Re: Native image generation

Posted: Fri Apr 12, 2024 2:35 pm
by ArneOrtlinghaus
I tried it nevertheless. I called NGen.exe for every dll
But the application doen't start anymore afterwards (AccessViolationException in XSharp.FixedMemory.Alloc(UInt32, UInt32), XSharp.RT.Functions.String2Mem(System.String), XSharp.Internal.CompilerServices.String2Psz(System.String, System.Collections.Generic.List`1<IntPtr>)
Additionally what would make it problematic for us:
NGen needs administrative windows rights and the process for register our files takes many minutes. So it is not possible to start a batchjob in the background and starting manually such a job on every computer is not interesting for a program that gets updates every week.
Arne