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

FSC - 15.8 - Not ngen'ed #5518

Closed
TIHan opened this Issue Aug 16, 2018 · 23 comments

Comments

Projects
None yet
9 participants
@TIHan
Contributor

TIHan commented Aug 16, 2018

Edit by @cartermp:

This affects desktop F# usage on Windows with VS 15.8. .NET Core is unaffected.

Original issue:

I updated my home machine to dev15.8 community edition from 15.7 and noticed my compile times are way longer than usual, ex: instead of taking 1.3 seconds to compile, it's now taking 5 seconds on a project of mine.

I had a thought that it is not ngen'ed, so I went and ngen'ed fsc.exe manually, and now it's back to 1.3 seconds. I don't believe this is intentional.

Workaround

Manually run one of these (Depending on Community/Professional/Enterprise):

ngen "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe"

ngen "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe"

ngen "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe"
@isaacabraham

This comment has been minimized.

Show comment
Hide comment
@isaacabraham

isaacabraham Aug 16, 2018

Contributor

How /where can we do this ourselves?

Contributor

isaacabraham commented Aug 16, 2018

How /where can we do this ourselves?

@TIHan

This comment has been minimized.

Show comment
Hide comment
@TIHan

TIHan Aug 16, 2018

Contributor

Run Developer Command Prompt for VS 2017,

Then run this in the prompt (VS install will vary):

ngen "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe"
Contributor

TIHan commented Aug 16, 2018

Run Developer Command Prompt for VS 2017,

Then run this in the prompt (VS install will vary):

ngen "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe"
@TIHan

This comment has been minimized.

Show comment
Hide comment
@TIHan

TIHan Aug 16, 2018

Contributor

I don't know if everyone is experiencing this, but it absolutely happened for me when I updated.

Contributor

TIHan commented Aug 16, 2018

I don't know if everyone is experiencing this, but it absolutely happened for me when I updated.

@nikonthethird

This comment has been minimized.

Show comment
Hide comment
@nikonthethird

nikonthethird Aug 16, 2018

@TIHan thank you, I was wondering why compilation was taking so long. Running your command totally fixed that.

Rebuild solution with 18 projects before running ngen: ca 30s

Rebuild solution with 18 projects after running ngen: ca 9s

nikonthethird commented Aug 16, 2018

@TIHan thank you, I was wondering why compilation was taking so long. Running your command totally fixed that.

Rebuild solution with 18 projects before running ngen: ca 30s

Rebuild solution with 18 projects after running ngen: ca 9s

@nikonthethird

This comment has been minimized.

Show comment
Hide comment
@nikonthethird

nikonthethird Aug 16, 2018

Running ngen:

C:\Windows\System32>ngen "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe"
Microsoft (R) CLR Native Image Generator - Version 4.7.3056.0
Copyright (c) Microsoft Corporation.  All rights reserved.
WARNING: This syntax is deprecated or you mis-typed your command.  Run "ngen /?" to display a list of the currently supported parameters.
1>    Compiling assembly FSharp.Core, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (CLR v4.0.30319) ...
1>    Compiling assembly FSharp.Compiler.Private, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (CLR v4.0.30319) ...
1>    Compiling assembly C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe (CLR v4.0.30319) ...

Just to be sure: After running ngen again, it does not show any output because the files have already been ngened, right?

C:\Windows\System32>ngen "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe"
Microsoft (R) CLR Native Image Generator - Version 4.7.3056.0
Copyright (c) Microsoft Corporation.  All rights reserved.
WARNING: This syntax is deprecated or you mis-typed your command.  Run "ngen /?" to display a list of the currently supported parameters.

nikonthethird commented Aug 16, 2018

Running ngen:

C:\Windows\System32>ngen "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe"
Microsoft (R) CLR Native Image Generator - Version 4.7.3056.0
Copyright (c) Microsoft Corporation.  All rights reserved.
WARNING: This syntax is deprecated or you mis-typed your command.  Run "ngen /?" to display a list of the currently supported parameters.
1>    Compiling assembly FSharp.Core, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (CLR v4.0.30319) ...
1>    Compiling assembly FSharp.Compiler.Private, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (CLR v4.0.30319) ...
1>    Compiling assembly C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe (CLR v4.0.30319) ...

Just to be sure: After running ngen again, it does not show any output because the files have already been ngened, right?

C:\Windows\System32>ngen "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe"
Microsoft (R) CLR Native Image Generator - Version 4.7.3056.0
Copyright (c) Microsoft Corporation.  All rights reserved.
WARNING: This syntax is deprecated or you mis-typed your command.  Run "ngen /?" to display a list of the currently supported parameters.
@isaacabraham

This comment has been minimized.

Show comment
Hide comment
@isaacabraham

isaacabraham Aug 16, 2018

Contributor

I can confirm the same as @nikonthethird here.

Contributor

isaacabraham commented Aug 16, 2018

I can confirm the same as @nikonthethird here.

@dustinmoris

This comment has been minimized.

Show comment
Hide comment
@dustinmoris

dustinmoris Aug 16, 2018

What about people who only updated the .NET SDK to 2.1.400 and not Visual Studio for Mac?

dustinmoris commented Aug 16, 2018

What about people who only updated the .NET SDK to 2.1.400 and not Visual Studio for Mac?

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Aug 16, 2018

Contributor
Contributor

forki commented Aug 16, 2018

@cartermp cartermp modified the milestones: 15.6, 15.8 Aug 16, 2018

@cartermp

This comment has been minimized.

Show comment
Hide comment
@cartermp

cartermp Aug 16, 2018

Collaborator

@dustinmoris @forki .NET Core uses cross-gen, not ngen, which happens in the build lab for .NET Core. So F# on .NET Core shouldn't be affected.

Collaborator

cartermp commented Aug 16, 2018

@dustinmoris @forki .NET Core uses cross-gen, not ngen, which happens in the build lab for .NET Core. So F# on .NET Core shouldn't be affected.

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Aug 16, 2018

Contributor
Contributor

forki commented Aug 16, 2018

@cartermp

This comment has been minimized.

Show comment
Hide comment
@cartermp

cartermp Aug 16, 2018

Collaborator

Note: this will still affect Visual Studio users who are targeting .NET Core, but if you're not using VS and using dotnet build/etc, then there's no regression.

Collaborator

cartermp commented Aug 16, 2018

Note: this will still affect Visual Studio users who are targeting .NET Core, but if you're not using VS and using dotnet build/etc, then there's no regression.

@KevinRansom

This comment has been minimized.

Show comment
Hide comment
@KevinRansom

KevinRansom Aug 16, 2018

Contributor

FSC should be ngened. Historically when VS installs the ngen activity is queued and run when ngen get's around to it. Typically this is within 24 hours.

We have changed the way we deploy the compiler, however, I wouldn't have expected it to change this aspect of the install.

I will investigate to see if there is an issue, however, I don't expect there to be.

The dotnet cli deployment of F# is native compiled using crossgen.

Contributor

KevinRansom commented Aug 16, 2018

FSC should be ngened. Historically when VS installs the ngen activity is queued and run when ngen get's around to it. Typically this is within 24 hours.

We have changed the way we deploy the compiler, however, I wouldn't have expected it to change this aspect of the install.

I will investigate to see if there is an issue, however, I don't expect there to be.

The dotnet cli deployment of F# is native compiled using crossgen.

@KevinRansom

This comment has been minimized.

Show comment
Hide comment
@KevinRansom

KevinRansom Aug 16, 2018

Contributor

The ngen flag for the deployed files are I believe correctly set here : https://github.com/Microsoft/visualfsharp/blob/master/setup/Swix/Microsoft.FSharp.Compiler/Files.swr

But my deployment on my main desktop also appeared to not be ngened. More digging is required.

Contributor

KevinRansom commented Aug 16, 2018

The ngen flag for the deployed files are I believe correctly set here : https://github.com/Microsoft/visualfsharp/blob/master/setup/Swix/Microsoft.FSharp.Compiler/Files.swr

But my deployment on my main desktop also appeared to not be ngened. More digging is required.

@KevinRansom

This comment has been minimized.

Show comment
Hide comment
@KevinRansom

KevinRansom Aug 16, 2018

Contributor

Yes it looks to me like we are not ngening The FSharp bits on install.

Contributor

KevinRansom commented Aug 16, 2018

Yes it looks to me like we are not ngening The FSharp bits on install.

@nikonthethird

This comment has been minimized.

Show comment
Hide comment
@nikonthethird

nikonthethird Aug 16, 2018

Could it possibly be that it's not just F# that's not ngened? The Nuget pages in VS also seem much slower than usual and take way longer to install/update a package.

nikonthethird commented Aug 16, 2018

Could it possibly be that it's not just F# that's not ngened? The Nuget pages in VS also seem much slower than usual and take way longer to install/update a package.

@cartermp

This comment has been minimized.

Show comment
Hide comment
@cartermp

cartermp Aug 17, 2018

Collaborator

@nikonthethird After a new VS installation it takes time for NGEN to run for everything in VS, so it may be that some slowness you're observing is due to that

Collaborator

cartermp commented Aug 17, 2018

@nikonthethird After a new VS installation it takes time for NGEN to run for everything in VS, so it may be that some slowness you're observing is due to that

@cartermp

This comment has been minimized.

Show comment
Hide comment
@cartermp

cartermp Aug 17, 2018

Collaborator

This is fixed in #5525. Next steps are to get a signed build and plumb it through the pipes to try and get into a servicing release. I'll report back with more details when we have them.

Collaborator

cartermp commented Aug 17, 2018

This is fixed in #5525. Next steps are to get a signed build and plumb it through the pipes to try and get into a servicing release. I'll report back with more details when we have them.

@cartermp cartermp closed this Aug 17, 2018

@KevinRansom KevinRansom reopened this Aug 17, 2018

@KevinRansom

This comment has been minimized.

Show comment
Hide comment
@KevinRansom

KevinRansom Aug 17, 2018

Contributor

@cartermp … Not fixed yet … the process is long, I merged it into a new branch so that we can get a validation build of VS.

Contributor

KevinRansom commented Aug 17, 2018

@cartermp … Not fixed yet … the process is long, I merged it into a new branch so that we can get a validation build of VS.

@Thorium

This comment has been minimized.

Show comment
Hide comment
@Thorium

Thorium Aug 20, 2018

Contributor

Compiling assembly FSharp.Core, Version=4.5.0.0

Does this mean that every project using the nuget-package should be ngened to compile the FSharp.Core because FSharp.Core itself in the nuget package is not ngened? And does this decrease the performance of typeproviders?

Contributor

Thorium commented Aug 20, 2018

Compiling assembly FSharp.Core, Version=4.5.0.0

Does this mean that every project using the nuget-package should be ngened to compile the FSharp.Core because FSharp.Core itself in the nuget package is not ngened? And does this decrease the performance of typeproviders?

@KevinRansom

This comment has been minimized.

Show comment
Hide comment
@KevinRansom

KevinRansom Aug 20, 2018

Contributor

@Thorium, This bug indicates that when Visual Studio ships the Visual FSharp Tools, it does not ngen the compiler or the tools. In fact FSharp.Core is ngened, because a different VS deployment mechanism handles that.

This change just ensures that the compiler and FSI and tools are submitted to NGEN on installation. It will improve the performance of compilation and FSI, it may also improve the IDE experience. Type provider performance is really independent of this change. Although in reality they are not a big part of the compile time.

Kevin

Contributor

KevinRansom commented Aug 20, 2018

@Thorium, This bug indicates that when Visual Studio ships the Visual FSharp Tools, it does not ngen the compiler or the tools. In fact FSharp.Core is ngened, because a different VS deployment mechanism handles that.

This change just ensures that the compiler and FSI and tools are submitted to NGEN on installation. It will improve the performance of compilation and FSI, it may also improve the IDE experience. Type provider performance is really independent of this change. Although in reality they are not a big part of the compile time.

Kevin

@goswinr

This comment has been minimized.

Show comment
Hide comment
@goswinr

goswinr Aug 24, 2018

I have the impression the performance of VS IDE tooling is also affected. apart form fsc.exe and fsi.exe are thet any other assemblies that i need to ngen to fix this on my PC ?

goswinr commented Aug 24, 2018

I have the impression the performance of VS IDE tooling is also affected. apart form fsc.exe and fsi.exe are thet any other assemblies that i need to ngen to fix this on my PC ?

@cartermp

This comment has been minimized.

Show comment
Hide comment
@cartermp

cartermp Aug 24, 2018

Collaborator

@goswinr You can look here for a full set, though I believe it should also NGEN the relevant dependencies (e.g., FSharp.Compiler.Private), which is used by the editor.

Collaborator

cartermp commented Aug 24, 2018

@goswinr You can look here for a full set, though I believe it should also NGEN the relevant dependencies (e.g., FSharp.Compiler.Private), which is used by the editor.

@cartermp

This comment has been minimized.

Show comment
Hide comment
@cartermp

cartermp Sep 20, 2018

Collaborator

The fix for this is in VS 15.8.5, which is now shipped.

Collaborator

cartermp commented Sep 20, 2018

The fix for this is in VS 15.8.5, which is now shipped.

@cartermp cartermp closed this Sep 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment