Short answer: I expected start-up time for bundles to be worse. The start-up time is actually good (about as fast as python) when using the -turbo option.
I did this to see how useful Cobra can be for scripting. Start-up time matters when executing something many times and not needing mono would be a big plus for server side code. It's good for scripts, but I wouldn't use it without mono.
---
If mono supported removal of unused data and functions (like gcc's options "-ffunction-sections -fdata-sections -Wl,--gc-sections"), this would be a lot more useful, but I guess this takes a lot of static analysis.
It's imho no wonder that the start up time is worse. Have a look at the file sizes for bundles - putting the DLLs and/or the whole mono runtime inside has some effect on the file size.
- Code: Select all
$ mkbundle --deps hello.exe -o hello-bundle
$ mkbundle --deps --static hello.exe -o hello-static
$ mkbundle -z --deps hello.exe -o hello-compressed-bundle
$ mkbundle -z --deps --static hello.exe -o hello-compressed-static
$ ls -sh hello-*
6,3M hello-bundle 5,2M hello-compressed-static
2,3M hello-compressed-bundle 9,2M hello-static
Just to qualify this: The start up time goes from around 100ms to 200ms for bundles and 300ms for compressed bundles. All executables are cached in memory (the first time, when the files are loaded from disk, it takes about 400ms for a bundle) This is cobra without optimization.
To compare: A python hello-world script takes about 33ms to execute, a C#-program 26ms and a compiled C program 2ms. With the turbo option, cobra takes about 37ms.
- Code: Select all
$ time mono hello.exe
Hello, world.
real 0m0.107s
user 0m0.090s
sys 0m0.013s
$ time ./hello-bundle
Hello, world.
real 0m0.242s
user 0m0.223s
sys 0m0.013s
$ time ./hello-static
Hello, world.
real 0m0.225s
user 0m0.217s
sys 0m0.007s
$ time ./hello-compressed-bundle
Hello, world.
real 0m0.321s
user 0m0.297s
sys 0m0.020s
$ time ./hello-compressed-static
Hello, world.
real 0m0.308s
user 0m0.293s
sys 0m0.013s
$ time mono hello-cs.exe
Hello World
real 0m0.026s
user 0m0.017s
sys 0m0.007s
$ time mono hello-turbo.exe
Hello, world.
real 0m0.037s
user 0m0.027s
sys 0m0.010s
$ time python hello.py
hello, world
real 0m0.033s
user 0m0.023s
sys 0m0.007s