Docker Community Forums

Share and learn in the Docker community.

Angular Compiler is REALLY slow

(Cyph, Inc.) #1

On my machine, outside of Docker, running ngc -p .[0] to compile my project takes 17 seconds. Within Docker, it takes a bit over an hour.

For comparison, the standard TypeScript compiler (tsc -p .) runs in 4 seconds outside of Docker and in 10 seconds within Docker.

I can’t imagine what ngc might be doing to upset Docker so much, but something is definitely wrong here.


(Tomfrost) #2

In Docker, are you running out of a mounted volume? If so, this issue likely falls under this problem: File access in mounted volumes extremely slow, CPU bound

(Cyph, Inc.) #3

That was my first thought as well, but just tested to make sure and it looks like this is reproducible either way. (I also can’t imagine that ngc would be super heavy on filesystem operations, at least not significantly more so than tsc.)

(David Sheets) #4

@cyph, that is very surprising. Could you please open an issue on with details of the container build/run you are performing, an example project/template set, and the exact command inside and outside of the container?

(Cyph, Inc.) #5

Well, I’d just set up a test case that I was about to submit there, but now I can’t reproduce the issue outside of mounted volumes. Not 100% why it was the case before, but I think I might’ve accidentally had a symlink to a mounted volume directory inside my non-mounted copy.

In any case, it looks like this is exactly what @tomfrost suggested, not a separate issue.

(David Sheets) #6

@cyph a test case would still be very useful. 17s -> 1h+ is far larger than expected for the current latency model of osxfs (~10x not ~180x). It is quite likely that your ngc workload triggers an unknown performance problem. Would it be possible to share your reproduction so that we could study it to understand why it suffers extremely poor performance?

(Cyph, Inc.) #7

Ah got it, not a problem then. Just pushed what I had for the test project to, which is just using the Angular quickstart project for now since the Cyph code needed to reproduce the problem isn’t in our public branch yet. The results with this version aren’t anything close to what I was seeing with the Cyph code (52-second compile time), so I’ll let you know after it’s been updated.

(Cyph, Inc.) #8

Okay, got a test case:

This repo is actually for an unrelated Angular issue, but it just so happens to reproduce this issue as well if you throw out the cp -a /test /test.tmp ; cd /test.tmp line from the readme. (With that line included, ngc takes 17 seconds; without it, I gave up and killed the process after 37.5 minutes.)