Native image generation

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
ArneOrtlinghaus
Posts: 382
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

Native image generation

Post 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
User avatar
wriedmann
Posts: 3631
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Re: Native image generation

Post by wriedmann »

Hi Arne,
if I remember correctly, this is executed in the installation process on the X# compiler.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4189
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Native image generation

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
VR
Posts: 98
Joined: Sun Aug 23, 2020 3:07 pm
Location: Italy

Re: Native image generation

Post 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.
User avatar
ArneOrtlinghaus
Posts: 382
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

Re: Native image generation

Post 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
Post Reply