This project is read-only.

Where can I find the source code for the plugin?

Topics: General
Apr 20, 2014 at 9:30 AM

where can I find the source code for the plugin?

The reason why I am interested in it, is because it seems to run very fast when the plugin compiles when saving in Visual Studio, compared to when I call the compiler myself.

So I am curious about what you do that makes the compiler run so fast.

When I am compiling only a few hundred lines of code I have to sit and wait for about 40 seconds for it to complete, which is becoming unbearable and I am thinking about switching back to writing in plain JavaScript again.

But if you are able to compile so fast I must be as well.

It seems to not matter with /// <reference> declarations when compiling on save in Visual Studio, but when I compile my files using the compiler they are needed as it will else break - I am thinking that it might be where the speed increase comes from?

Any other ideas to speed it up?

/ Martin
Apr 20, 2014 at 10:42 PM
you don't have to /// <reference> all the files in VS because by default every file is referencing all other files in the project (in earlier versions, there was a file that referenced all files, and every file referenced that file). So the speed isn't won there.

Because the plugin source isn't open source I can only guess:
  • compiled stuff is kept and not compiled again if there were no changes.
  • if you switch files the now un-active file is pre-compiled and cached.
  • there may be some other minor / major tweeks but these two should bring a huge performance boost.
Apr 20, 2014 at 11:42 PM
I figured out how to improve the speed.
Before I would run through all .ts files and compile them separately which took an awful lot of time as it seems to be very costly to start the the compiler - about 5-7 seconds per file.

Now I combine all the files into one big temporary file and then compile it, and it also takes 5-7 seconds.
So it seems that it is starting up the compiler that takes all the time, not the actual compiling itself.

/ Martin
Apr 21, 2014 at 4:46 PM
The plugin is faster for compile-on-save because it's basically already done the parse/typecheck. After that, all it needs to do is write out the .js file.

You can get a similar capability on the commandline using the npm-based TypeScript compiler and the --watch feature. This will watch for changes in the file and run a recompile when files are out of date.

We don't do any caching yet, but we're currently exploring ways to make the compiler faster for future releases.