Monkey speed + documentation request

Community Forums/Monkey Talk/Monkey speed + documentation request

Farflame(Posted 2012) [#1]
Just playing around with Monkey, overall I like it, but have a couple of questions.

Firstly, I know the question is asked all the time, but how do people rate the speed of Monkey, compared to BlitzMax? I realise it varies between hardware, but I'm finding that the exact same code runs quite a bit slower on Monkey than it does on Blitzmax. I've taken a simple sprite test, and run it on the same machine on both languages, and BMX seems happy to run 3000 sprites without any issues, but Monkey is slowing down a bit with that many.

I don't think it's a major issue anyway, 2000 sprites is enough for any game and it's worth it to have a game running in a browser :)

Or maybe I'm doing something wrong? Are other people able to get BMX performance with Monkey?

Secondly, just a minor question, could somebody link me the documentation for the Include statement for Monkey? It crashes whenever I hit F1 and I'm being forced to use Import, which is causing a bug in my code (not sure why). I think using Include would simplify it at this stage.

I should point out I'm using the demo, which seems quite a long way out of date.


Yasha(Posted 2012) [#2]
Monkey is a perfect example of the old adage that you can't compare the speed of languages, only of implementations - because it has no fewer than six implementations in the distributed version!

(Note that I'm answering off the top of my head here: I don't use Monkey myself...)

For creating desktop apps rather than browser games, Monkey also offers a C++ backend. For most purposes this *should* be equivalent in speed or potentially as much as twice as fast as BlitzMax, at the language level, because current C++ compilers have obscenely powerful optimisers, and thus produce excellent code.

You also have to consider the effect of the platform used to run the game. C++ and Flash targets should be constant across different systems and mainly affected by the hardware, since C++ of course compiles to native code, and Flash has only the one implementation. But there's a huge gulf of performance difference between the .NET and Mono implementations of the CLR, should you get adventurous with the C# backend; there are several different Java implementations in common use (although this would require some tweaking since the Java target I believe is intended solely for Android), and of course HTML5 performance will be determined primarily by which browser the user tried to use, and how the browsers are competing this month.

Consider also that CLR, Java and JavaScript all make heavy use of JITting, polymorphic inline caching, dynamic recompilation and other buzzwords that completely change the performance characteristics of the result program, as well as the performance average (i.e. usually means they will start slowly but have the potential to accelerate to C++-speeds if run for a few minutes). I don't know for sure but I assume that Objective-C and C++ targets are using reference counting rather than garbage collection, as well, which will make for more reliably consistent performance without necessarily making them faster overall.

In other words, yes, but it depends what you set out to do, and what you want to build for; and it's not really a fair comparison in a lot of cases.


Farflame(Posted 2012) [#3]
Thanks for the reply.

Yes, I've read a few similar topics and this seems to be the general consensus - i.e, that you can't really make a comparison. I guess one way to look at it is, if it runs 2000 sprites on my PC, it should probably run fairly well with 100 sprites on most platforms. Unfortunately I don't have access to any other platforms to make tests - I should probably grab hold of a cheap phone or something to play around with because I think they're much slower than PC's in general?

Regarding the Include/Import issue. It's occured to me that I don't actually understand the difference between the two, even in BMAX. I just use Include because that seems to do what I want, i.e split my program into smaller chunks. Not sure why it doesn't work in Monkey, although it's probably just a bug in the demo.


AdamRedwoods(Posted 2012) [#4]
monkey doesn't use 'include' if I recall correctly. Only Import.

Is the demo version only HTML5 or did you get it to run some GLFW/mingw code? The GLFW is the windows/macos target and is much faster than HTML5.

Plus I think the latest version (v52) has a new garbage collector, speeding up sprites on Mac and iOS targets.


Farflame(Posted 2012) [#5]
Yeah it's HTML5 only. I think you're right, these are probably issues with the demo which is very old now (version 0.34 I think, so it's about a year old). Think I'll just buy the full version, I'm a big fan of Blitz (I have every version of that too), and although I'll never make money from it, I like playing around with little games and it's silly to play around with an old version.


xlsior(Posted 2012) [#6]
Most smartphones are ~800MHz - 1GHz, with the high-end ones being faster.
A bigger bottleneck is that the phone's video capabilities tend to be significantly slower than a PC with half-decent video adapter.


Farflame(Posted 2012) [#7]
Think I need to get myself a really weak phone to see exactly how bad they are. I'm just making a simple little shooter, but it would be interesting to see what these things can handle. Where would I get a crappy old phone, Ebay? Or I suppose more sensibly, I could upgrade my own mobile to some mid-range smartphone. I'm so old now, I've reached that age where I refuse to know what a smartphone is :p

Good thing about this new market, I feel like my old ZX Spectrum ideas are suddenly viable xD


Volker(Posted 2012) [#8]
demo which is very old now (version 0.34 I think, so it's about a year old)

There is a newer demo available (based on V45).


smilertoo(Posted 2012) [#9]
I was considering monkey until i saw that the $120 price magically becomes £100 using some 20 year old price conversion system, i thought those days were over.


Floyd(Posted 2012) [#10]
I was considering monkey until i saw that the $120 price magically becomes £100

That seems excessive. I just tried the Store link at Monkeycoder. Share*It gives the price as $120 or about £83. Is some horrible %20 tax added later?