First of all: This code I want to compile aren't plugins. They are more or less small applications. The main program doesn't do much without them. It's somehow like a small game engine or a engine for simulations. Most things can be set up in config files. You don't need a single line of code to create a working application. but you can use lots of entry points to replace things or to extend it.
I didn't say anything about the compilation/interpretation process in particular. I just said scripts are sometimes way slower than a lower level programming language. Probably this can have many reasons. I'm no expert, but I came across these two by myself (correct me if I'm wrong):
1) Optimization:
A script can't be optimized the same way as a C++ Programm due to paradigms like dynamic typing. The compiler has a hard time optimizing the code if the variable types changes all the time. E.g. look at Mozilla's "asm.js" which led to an incredible performance boost, just by making ECMAscript type-safe. On the other hand I observed that many VM's are able to optimize things in runtime, something that c++ can't do. But in my observation this hasn't much impact.
2) Virtual Machine:
As you mentioned scripted languages always come with a VM (mainly for memory management). These are always generating some extend of overhead. In my personal opinion this needn't lead to a remarkable performance change, but at least in some languages it really does. I gave up programming in Java because of the high memory consumption.
I just want to put this in numbers:
I implemented a short algorithm that adds up millions of numbers. This isn't a standard task in most programs, but as my engine is able to do physical simulations in real time and as most of the algorithms should be replaceable by the user such calculations definitely matter to me.
With the exact same implementation in both languages I got an average of 8.7 seconds in python and 0.5 seconds in C++. This is a remarkable difference. (My own self test might not be representative, but other professional tests show similar results. Just look at this
http://readwrite.com/2011/06/06/cpp-go-java-scala-performance-benchmark . These aren't scripting languages, but it shows the big difference to other languages. Also you can play with this website:
http://benchmarksgame.alioth.debian.org/u64/benchmark.php?test=fannkuchredux&lang=all&data=u64)
My engine is among others capable of rendering 2D/3D content in real time (GPU) and simulating physics (CPU, at a later time perhaps also GPU). As I said lots of critical parts should be replaceable. Maybe (if necessary) the user should even be able to optimize some parts with ASM. But I'm not quite sure yet about that one (because of portability). Because this is real time even a performance difference of about 10% would matter to me.
In other words, unless your users know that they must have a working, accessible, and sane compile-time environment as part of your application's deployment, then it will be something that will frustrate your users. |
Actually there are two types of users. There are developers and end-users. Only the developers will need a working build-environment. And only the developers will use the IDE. When they're ready the IDE automatically cross-compiles the necessary libs and executables. Then all is uploaded to a repository on my webserver. (The repository/packaging system is already working. Only the compiling system is missing yet.) The end users just download and install these binary files (through the packiging service). So they
don't need the build system.
I think making sure that g++ is installed under Linux is not a big deal. Under Windows and OS X I could package it as you said. This not a big deal either as I wrote a packaging service anyway.
For other platforms: I think that
developers that are
not working under Windows/OS X or Linux are able to install g++ on their own. Also Linux/Windows/OS X is the minimum portability that I want to achieve.
Also consider that I'm a non-professional, just-for-fun OpenSource programmer. My main question isn't: "What is the use/cost factor?", my main question is: "Does it make fun?" I don't want do something that doesn't make sense though. So do you still think I should use scripts?