-
Notifications
You must be signed in to change notification settings - Fork 358
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
Node Projects in Visual Studio are taking twice as long as to build #2107
Comments
Is anyone out there? 👻 |
I've noticed something else. It looks like the Node projects are building synchronously. For example, on a non-Node TypeScript set of projects, I see the following on the output screen:
For each project there are two entries. One showing the asynchronous start of the build and the other showing the build completion. (The first set of entries are printed in quick succession.) However, for the NTVS projects, I only see one entry per project:
The key thing is these projects appear to be building synchronously. Each line takes 4-8 seconds to print. Unlike for the standard TypeScript projects, there is no corresponding second entry. Visual Studio schedules builds on all available CPU cores. Does anyone know why this is not happening for Node projects? |
Hey, guys, I just spoke to my pal Satya Nadella and he says whoever fixes this will get a promotion and a Christmas bonus. |
Hey @NoelAbrahams, sorry for the delay. I think we had a separate thread about this on the TS repro. Is there anything left to do here? |
Hi, @amcasey this is still an outstanding issue: NodeJS projects do not build in parallel in Visual Studio. I've upgraded to VS 2019 and the issue is still there. |
@NoelAbrahams Thanks for confirming! We'll look into it. |
@amcasey is there a fix for this? Happy to test and provide feedback. |
@NoelAbrahams Sorry, we've had a lot on our plates (the same team supports a lot of non-Node scenarios) and this has yet to rise to the top of the stack. We haven't forgotten about it though. Thanks for your patience. |
@NoelAbrahams: I took a jibe at this and I did conclude that node projects in a VS solution do build in parallel permitting the presence of available cores. The output you see in the window comes from build targets file which varies based on the different project systems (ASP.Net, NodeJS etc), but it doesn't reflect async or parallel behavior of the build process. That being said, I would like to understand why you see difference in performance based on your project types. Could you tell me more about the projects you are comparing? There is a lot of underlying dependencies of different project systems in VS which might cause difference in build times. Also if you are curious and want to investigate build timing issues, you can use msbuildlog to dig more. |
@rakatyal thanks for looking into this. The projects I'm comparing are
and
All projects only contain TypeScript code. There is nothing else (ie no C# or anything else). The only difference between the two project types is that the NodeJS projects are based on the CommonJS framework (ie. TypeScript compiler option If I select a set of the ASP.Net projects and build them then I get the output as expected: output in random order. But if I select a bunch of Node.Js projects then the output is a bit strange because the projects always seem to build in the same order. The build is also much slower. I recently upgraded from a 4-core to an 8-core machine, but failed to see any improvement in the NodeJS projects. Just as a start, do you know why the output from the NodeJS projects are always in the same order? I wouldn't expect this if they are being built in parallel. |
@NoelAbrahams: A solution build inside VS is controlled by something called 'Build Solution Manager'. In simple terms, when there are multiple projects in a solution, it creates a dependency tree (with the help of the project system those projects belong to) and then triggers parallel builds on available cores based on this tree (The number of available cores are automatically detected or controlled by Tools -> Options -> Projects and Solutions -> Build and Run). Once a project is built and the core becomes available, the build manager hands it the next project in the dependency tree and so on. A single project build is handled by the project system itself, but the parallel triggering of builds is done by the Solution Build Manager and that should be same across all project types. Now as I mentioned earlier, the output you see in the windows inside VS comes from the project build target files which differ according to the project systems. Why ASP.NET provides random order and NodeJS do not, I am not sure. The order might just be the order in which projects are present in the solution file. But rest assured, this does not indicate that projects are not being built in parallel. |
@rakatyal thanks for the background info. Let's establish a couple of things:
In short, there are no configuration or hardware problems associated with the issue. I just ran a simple test: In Visual Studio I selected 9 projects of each type and built them. Here are the results:
The Node projects have much fewer files. Here are the metrics
It does look like something really strange is going on if the NodeJS projects are taking 3 times as long to build with a much smaller set of files. Are you able to see similar metrics yourself? What happens when you create say 4 NodeJS projects in Visual Studio and build them? |
@NoelAbrahams: What results do you see when you build single projects? Did you try using the tool I mentioned before for detailed analysis? There seems to be 2 different questions here. One is your query if the Node projects in a solution build differently than others (which I have already established is not true and handled by the VS solution build Manager and not the project system) and the other seems to be concerning build time of one project type vs other. Are you now looking for answers on the latter? |
@rakatyal yes, I'm looking for answers to the latter; that should be clear from the title of the issue. I only mention the parallel build (or lack thereof) because I thought that might be a potential reason for it. The individual project build times are as follows:
Can you tell me how is it that one NodeJS project builds in 6 seconds while 9 projects take 44 seconds on a machine with 8 cores? What sort of detailed analysis do you want me to carry out? I'm actually trying to report a bug in your systems. |
@NoelAbrahams: Thank you for all your help and investigations so far. We are just trying to root cause the issue and hence the follow ups :) I did take a more deeper look into this and there might be something quirky, particularly about the NodeJS TS Web App Project type. I think your initial assessment that project builds are not happening as expected (in parallel) might be right. I validated this by trying out the command line msbuild to build the VS solution. I noticed that my solution with multiple NodeJS Web App projects build significantly faster via that. I am working on figuring out why the VS Solution Build Manager isn't doing what it's supposed to. Meanwhile, if you are trying to have better build performance (and also validate what I found), you can try doing this as well.
Let me know if you notice any changes. I will update here once I find out more. |
@rakatyal, yes a MASSIVE improvement. This is what I get for a set of nine projects.
The 8 seconds is definitely what I'd expect given the multi-core setup we have. Please let me know if you need me to check anything else. It would be great to see this fixed in Visual Studio as it's really not possible to run the command line as part of the normal workflow. |
@rakatyal are you still investigating this issue? No rush: it's only been five months. |
Node JS projects are taking twice as long to build as standard TypeScript projects (creates via the ASP.Net project types).
This is quite noticeable in large solutions.
Is there a way to profile this to see what's causing the slowness?
I should add that there is nothing special about the code in the projects. They are pretty much identical across Node and non-Node projects; just standard TypeScript.
The text was updated successfully, but these errors were encountered: