Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why do .NET applications have at least a one-second startup delay? #1411

Open
amymor opened this issue Oct 29, 2023 · 0 comments
Open

Why do .NET applications have at least a one-second startup delay? #1411

amymor opened this issue Oct 29, 2023 · 0 comments

Comments

@amymor
Copy link

amymor commented Oct 29, 2023

Hello
I was seeking a language with the following parameters:

  1. Simple and readable syntax.
  2. Capability to effortlessly create Windows user interfaces.
  3. Native support for Windows applications.
  4. Superior performance and quick startup times.
  5. Portability, eliminating the need for extensive installations like the 10-20 GB Visual Studio IDE.
  6. It should already be widely used and possess a substantial community.

I discovered that VB6 meets my needs, but unfortunately, it is no longer supported. Therefore, I tried VB .NET. I found the transition to be quite easy, and the VB code was far more readable and concise compared to C#/C++. As I had mentioned, I did not want to install anything, so I did not try .NET 6 and 7. I aim to utilize built-in tools like vbc.exe or portable tools as much as possible. However, the problem with .NET framework is that the startup time remains consistently between 1-2 seconds, regardless of the code's weightiness or the language used (VB or C#). In contrast, VB6 applications start immediately. Here's an example that is written in VB .NET:

Imports System.Windows.Forms
Imports System.Drawing

Public Class Form1
    Inherits Form

    Private WithEvents button As New Button()
    Private WithEvents textBox As New TextBox()

    Public Sub New()
        button.Text = "Browse"
        button.Location = New Point(10, 10)
        Me.Controls.Add(button)

        textBox.Location = New Point(10, 40)
        Me.Controls.Add(textBox)
    End Sub
End Class

Module Module1
    Sub Main()
        Application.Run(New Form1)
    End Sub
End Module

What I did:

CD C:\Windows\Microsoft.NET\Framework64\v4.0.30319 
NGEN update
  1. I tried various options for the vbc.exe (and csc.exe) compilers, such as /optimize[+|-] and /platform.
  2. Different versions of the .NET framework (both 32-bit and 64-bit) including versions 2, 3.5, and 4.x.x.
  3. Using msbuild.exe to compile my application with the following command:
    msbuild /property:Configuration=Release;UseDotNetNativeToolchain=true MyFile.vbproj

here is content of MyFile.vbproj:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Sdk="Microsoft.NET.Sdk" >
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
    <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="DiCalc.vb" />
  </ItemGroup>

<Target Name="Build">
  <Vbc Sources="@(Compile)" OutputAssembly="DiCalc.exe" TargetType="WinExe"/>
</Target>


</Project>

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant