XOJO speed vs other languages after being compiled?

Hey folks.

I’m wondering what your experiences are with XOJO and compiled apps as far as speed? I mean, all things being equal, what kind of speeds do you get compared to C++ or some other languages such as C Sharp, etc? Anyone studied these type of comparisons I’m wondering?


It depends a lot on the kind of app. For example, if you’re waiting on file IO, it doesn’t make a difference what language.

Hi Joe,

Yeah, I was considering more DB stuff / N-Tier stuff as that’s what I’ve developed for in the past when I worked in the IT field full time back in the day… :slight_smile:

I have done some extensive comparison with code that is very math intensive (long runs with no I/O or GUI interaction). For code such as integer factorization and FFT multiplies the difference is dramatic. I have seen a difference of 26X and higher with equivalent code in C++ as compared with XOJO.

I don’t think you’ll see a giant difference in performance, since most of that stuff is waiting on the network or filesystem.

Yeah, the current compiler backend is definitely non-optimizing. For 64-bit builds, the compiler is going to leverage LLVM’s optimization pipeline and code generation. While it’s never going to generate code that’s as fast as C++, it is a definite improvement. I’ve seen a 15x performance increase with the LLVM backend on math-heavy code, but the increase is entirely dependent on type of code and how it’s written.

Joe, is the reason that XOJO will never match C++ have to do with LLVM not optimizing XOJO as much or is it the inclusion of stack overflow, nil object checking and so forth.

The fundamental and unavoidable limitations come from language features like exception handling, deterministic reference counting, nil object checks, bounds checks, overflow checks, and object overhead. There’s a bunch of other things in the way before getting even near a hypothetical maximum speed though, including the internal design of the compiler.

As Joe says, by default Xojo is a safe language, not necessarily a super fast one.

However, by using the built-in optimization features, you can get code that is pretty fast. (At some trade-off with safety - you only want to do this after debugging your code). Here’s a fun example showing a 35x speedup in an algorithm by judicious use of Xojo coding techniques : https://forum.xojo.com/13818-faster-encyrption-obscuration-than-rc4-for-large-24mb-15mb-file

just my thoughts on this:

As Michael Diehr has shown us with his rc4 example, xojo is fit to iterate through complex encryption/decryption in a pretty fast time with reasonable results and compareable with other languages like C or C++ except you’re using external Libs written in pure Assembler I guess.

Of course there are lot of ways to compare languages with single math tasks: Just take PowerBasics example here:

This may be important in science but has nothing in common with modern business software development enviroments. In fact benchmarks for langauges are quite useless when you can make use of external Engines/libs/dlls or even run certain tasks complete out of your software via helper apps through shell/ threads etc.

I just throw in this very old but still valid Video: