Faster SharpKit Build Time?

25 views
Skip to first unread message

Michael Tanner

unread,
May 22, 2015, 11:26:45 AM5/22/15
to shar...@googlegroups.com
As my VisualStudio web project has grown larger it can now take 15 - 20 seconds to build the project.  When I make small changes in the SharpKit-based C# code I have to again build the project and then sit & wait.

Is it possible to execute SharpKit from a command line so I can bypass rebuilding the entire VS project?  The reason my project builds so slowly is not because of SharpKit, but because of the many other libraries.  When I just need to update my UI code it would be nice to just build/compile the SharpKit parts.

Thanks!

-Michael

Peter Hultqvist

unread,
May 22, 2015, 12:28:46 PM5/22/15
to shar...@googlegroups.com
You can check the build output and copy the command and arguments from there.

Or you can build the arguments yourself, I use a script like this:

DLLARGS=""
for dll in $PROJECT/bin/$CONF/*.dll
do
        DLLARGS="$DLLARGS /reference:$dll "
done
../3rd/SharpKit/Compiler/skc5/bin/skc5.exe "/define:$DEFINE;API;SCRIPT" \
        $DLLARGS \
        /reference:/usr/lib/mono/4.0/System.Core.dll \
        $PROJECT/API/**/*.cs \
        WebShared/API/**/*.cs \
        $PROJECT/**/AssemblyInfo.cs \
        WebShared/**/AssemblyInfo.cs \
        $PROJECT/**/Generated.cs \
        /target:library \
        /rebuild /TargetFrameworkVersion:v4.0

It should work as long as you don't do any major changes in the code. But be aware, I have had some weird "bugs" because the build was based on an outdated .DLL.

I'm using yet another tool that will run this script whenever a .cs file is modified, so I can trigger a recompile by saving a file.

SharpKit also has some compiler service. I believe  it is a process that keeps running in the background and caches the work to improve the cs to js compilation time.


--
You received this message because you are subscribed to the Google Groups "SharpKit Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sharpkit+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dan-el Khen

unread,
May 24, 2015, 4:50:56 AM5/24/15
to shar...@googlegroups.com
Hi Michael and Peter, long time!

20 seconds? That sounds a bit long. Can you check that you're using the SharpKit Windows Service? Also, what's your Machine/OS specs?
To check the service go to http://localhost:7667/Compile?CommandLineArgs=/why, or:
1. run services.msc
2. Check that SharpKit service is installed

You can also run the installer again and make sure that it has optimized the assemblies for your machine. Basically the windows service caches the parsing of the same system dlls, which actually makes the compilation much faster.

Let me know, and we'll take it from there. Peter perhaps you should check that too.

Cheers guys
D.




Michael Tanner

unread,
May 26, 2015, 11:36:58 AM5/26/15
to shar...@googlegroups.com
Thanks Dan-el,

It appears that I didn't have the SharpKit service running. I just downloaded and reinstalled 5.4.4 and my build takes about half the time as before. I'm currently running a Windows VM on a MacBook Air (has been really fast in the past). 

I recently began using the SharpKit package from NuGet to help make my project more portable to other developers. I assume this approach would be slower than having SharpKit run as a background service?

Thanks for you help Dan-el ... I love using C# for JavaScript output and SharpKit makes this easy!

-Michael

Dan-el Khen

unread,
May 26, 2015, 11:48:27 AM5/26/15
to shar...@googlegroups.com
Hi Michael,

Great! If you use the nuget package that it will definitely be slower by default. You can always speed it up by manually running:
skc5.exe /service:console

Where skc5.exe is the file you've downloaded via nuget. This will simply run the SharpKit service as a simple console app that listens to the same port. You have to be careful of course not to run multiple instances of the service, since they all use the same port and will fail to listen to the same one at once.

I've tried the MacBook+VirtualBox combo, and personally I prefer the macbook+bootcamp+native windows option better. :-)

Regarding the build time - after the first build it should be much faster, things you can consider that might help:
1. If you have many projects in your solution - consider setting Tools->Options->Projects and Solutions->Build and Run->Only build startup projects and dependencies needed to run
2. Check if you run x64 or x86 version of windows, as well as if SharpKit runs in x64 or x86 mode. If you have a strong machine with a 4 or more cores, x64 might work faster.

Cheers
D.




Michael Tanner

unread,
May 26, 2015, 11:57:02 AM5/26/15
to shar...@googlegroups.com
Thanks Dan-el, this is a huge help. I was just able to reduce the build time to a few seconds by removing the SharpKit NuGet packages and referencing the SharpKit assemblies directly.

Thanks!

--
You received this message because you are subscribed to a topic in the Google Groups "SharpKit Support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sharpkit/LsyK2-aGK-A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sharpkit+u...@googlegroups.com.

Dan-el Khen

unread,
May 26, 2015, 11:59:20 AM5/26/15
to shar...@googlegroups.com
Great, let me know if you stumble upon any other issues.

Cheers
D.
Reply all
Reply to author
Forward
0 new messages