This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-10-15 01:52:43

deerel
Scratcher
Registered: 2008-08-23
Posts: 89

Java player nearly 20x slower than Scratch

This project shows it: http://scratch.mit.edu/projects/deerelResearch/292492
I am getting cca 12.3 on the first variable in Scratch and 0.66 in Java player. The project does not do any graphics - it does only broadcast and computation. Could you please correct it somehow, in v32, I hope soon? Projects with many parallel elements doing some computations are de facto ruled out with actual Java player though they may work smoothly in Scratch itself... Thanx.

(if you could spare me the source codes of Java player, I'll be even more glad because I could find the source of problem myself and see if it is correctable or not)

Offline

 

#2 2008-10-15 05:15:42

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Java player nearly 20x slower than Scratch

Interesting!  However, on my machine the Java performance is only 15% below the Scratch performance in Presentation mode (4.5 versus 5.3).  And I would think you would want to change your benchmark program to use "Broadcast And Wait" rather than Broadcast so that each calculation runs to completion before the next one starts.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2008-10-15 10:18:21

deerel
Scratcher
Registered: 2008-08-23
Posts: 89

Re: Java player nearly 20x slower than Scratch

Paddle2See wrote:

Interesting!  However, on my machine the Java performance is only 15% below the Scratch performance in Presentation mode (4.5 versus 5.3).

Strange. I'd like to know also from others, what are their results...
I have WIndows XP, Safari 3.1.2 and IE 7.0 (it's the same for both), Java 1.6.0_04. Your machine seems to be even slower (I got 12 in presentation mode), but you get decent performance of Java player, hm ...

Paddle2See wrote:

And I would think you would want to change your benchmark program to use "Broadcast And Wait" rather than Broadcast so that each calculation runs to completion before the next one starts.

No, this is exactly as it should be. Every calculation runs to the completion even when you use broadcast - moreover, if you used broadcast and wait, you would add empty step after every calculation - it will do nothing but processed from "broadcast and wait" to end of the loop and be idle for the rest of minimal time per step (1/32 s in v31) (and in Scratch 1.2.1 it was even worse if you put broadcast and wait before loop end, it would cost you two empty steps, I reported it as bug but get no answer, http://scratch.mit.edu/projects/deerelResearch/292675 this project illustrates it, you get x:y ratio of 3:! in Scratch 1.2.1, v31 only produces 2:1, I'd like to see 1:1 and suggested how to achieve that here http://scratch.mit.edu/forums/viewtopic.php?id=9154 and here http://scratch.mit.edu/forums/viewtopic.php?id=9171 combination of this would yield 1:1 ratio).
Using broadcast instead of broadcast and wait means it is "fully bursted" and nothing else then (complete) calculation is done. Trust me, I have studied the source code, especially the execution engine.
This is the way how benchmarks should be done for Scratch - Scratch works in steps, every step performs every script that should be run up until interruption point, and if time spent by step was less than some threshold (1/32 s for v31 from my research), it will wait so it spends at least that time. That's why this minimal time must be filled so it does not compromise the benchmark results. Interruption points mentioned earlier occur ONLY in end of iteration or specific block that induce wait - like wait for x seconds or broadcast and wait.

Last edited by deerel (2008-10-15 10:53:51)

Offline

 

#4 2008-10-15 13:20:42

deerel
Scratcher
Registered: 2008-08-23
Posts: 89

Re: Java player nearly 20x slower than Scratch

deerel wrote:

Paddle2See wrote:

Interesting!  However, on my machine the Java performance is only 15% below the Scratch performance in Presentation mode (4.5 versus 5.3).

Strange. I'd like to know also from others, what are their results...
I have WIndows XP, Safari 3.1.2 and IE 7.0 (it's the same for both), Java 1.6.0_04. Your machine seems to be even slower (I got 12 in presentation mode), but you get decent performance of Java player, hm ...

Hallelujah! Installing newest Java (6.0 update 7) helped. Now i'm going to run the rest of my benchmarks... you can delete this topic if you want, 20x is no more true.

Last edited by deerel (2008-10-15 13:22:07)

Offline

 

Board footer