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

#1 2012-01-20 19:52:43

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Flash Player Speed Test Experiment

(I've posted this in All About Scratch because I don't think any of this is *too* technical, and it's I think it will be useful to most Scratchers.)

UPDATE - 1/21/12 - Here I have more results with testing in Turbo Mode.

Introduction

The Flash Player has confused me for a very long time. What makes it so fast? Many games that were incredibly slow (in Scratch 1.4 and the java player) can now be played very easily in the Flash Player. For example, check out Scratch Kart Demo by RHY3756547. In the java player, it's unplayable (doesn't actually load). In Scratch 1.4, it's playable, but doesn't live up to it's full potential. In the flash player, it runs at a much greater speed, and is very enjoyable.

Experiment

What I decided to do is set up an experiment. My purpose was to find out what features of the flash player are faster than Scratch 1.4 or the java player. My background research was... well there wasn't any xD. My hypothesis was that the flash player would be faster, as that is what I have found in my general experience. My procedure was to create a project that tested the different features of Scratch, and to test it in all 3 platforms (flash player, java player, and Scratch 1.4).

This is the project with the tests. The 7 tests were all within repeat (100) blocks, while using the timer to determine how long each one took. I repeated the project 3 times in each platform and averaged the times together for an accurate result. Inside the repeat (100) blocks, I had the following:

- nothing
- broadcast and wait (with an accompanied "when received" block)
- pen drawing in a square
- rotating square
- increasing size of Scratch Cat
- increasing ghost effect of Scratch Cat
- stamping Scratch Cat at random positions

Results

Here are my results:

Scratch 1.4

Test 1: 2.502 seconds
Test 2: 7.504 seconds
Test 3: 2.501 seconds
Test 4: 2.646 seconds
Test 5: 2.545 seconds
Test 6: 2.502 seconds
Test 7: 2.588 seconds

Java Player

Test 1: 3.000 seconds
Test 2: 6.000 seconds
Test 3: 3.000 seconds
Test 4: 3.000 seconds
Test 5: 3.000 seconds
Test 6: 3.000 seconds
Test 7: 3.000 seconds

Flash Player

Test 1: 0.000 seconds
Test 2: 3.276 seconds
Test 3: 3.287 seconds
Test 4: 3.288 seconds
Test 5: 3.316 seconds
Test 6: 3.315 seconds
Test 7: 3.308 seconds

Conclusion

Let's start with Scratch 1.4. A repeat block takes about 0.025 seconds for one loop, and a broadcast block takes 0.05 seconds to be sent and received. These are the underlying causes of lag in Scratch. Apart from that, test 4, 5, and 7 have a bit of a difference, but nothing important.

Now let's take a look at the java player. A repeat block takes about 0.03 seconds for one loop, and a broadcast block takes 0.03 seconds to be sent and received. The results of these tests were very consistent. So, the broadcasts are faster than those in Scratch 1.4, but the repeat blocks are slower.

Lastly, the flash player. The repeat block takes 0 seconds for one loop, and -- wait what!? It seems that the flash player is smart enough to see through this trick, and simply ignores the empty repeat block. The rest of the results are fairly similar, varying from 3.275 to 3.325 seconds.

This is confusing however, because these times are greater than those of Scratch 1.4. Yet the flash player is faster? Clearly my hypothesis is wrong. What I have concluded is that I have done a lot of rendering which is slower than Scratch 1.4, but I have not tested calculating, which I guess is faster. I am most likely going to make another experiment to test this.

Well that's the end! I hope you've learned a bit about the flash player. If you have any comments about the results, or suggestions for the next experiment (to test calculations and long scripts), then please do post!

And of course, Scratch On!  smile

Last edited by Lucario621 (2012-01-21 16:33:49)


http://i.imgur.com/WBkM2QQ.png

Offline

 

#2 2012-01-20 20:05:14

catfan8
Scratcher
Registered: 2008-07-23
Posts: 500+

Re: Flash Player Speed Test Experiment

Well the one case when the flash player is faster is the broadcast and wait, which is used a lot more than those other functions like ghost effect or nothing  tongue


http://mag.racked.eu/cimage/i9002/Sword-In-Back+get%21/HEROBRINE+Y+U+NO+EXIST/mca.png

Offline

 

#3 2012-01-20 20:53:09

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Flash Player Speed Test Experiment

catfan8 wrote:

Well the one case when the flash player is faster is the broadcast and wait, which is used a lot more than those other functions like ghost effect or nothing  tongue

A yes, that's right, I didn't catch that. I would still say that ghost effect is a fairly useful feature, even though it's a bit uncommon. As far as the "nothing", that's important because "nothing" applies to *every script*. The time to move 10 steps 100 times is the time it takes to do nothing 100 times, plus the time it takes to move 10 steps 100 times. So if the time to do nothing was always 0, then our projects would be 0.025 faster per frame in Scratch 1.4, which may seem like a little, but it's actually quite a lot. Sorry if I didn't explain it that well.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#4 2012-01-20 22:17:37

catfan8
Scratcher
Registered: 2008-07-23
Posts: 500+

Re: Flash Player Speed Test Experiment

Lucario621 wrote:

catfan8 wrote:

Well the one case when the flash player is faster is the broadcast and wait, which is used a lot more than those other functions like ghost effect or nothing  tongue

A yes, that's right, I didn't catch that. I would still say that ghost effect is a fairly useful feature, even though it's a bit uncommon. As far as the "nothing", that's important because "nothing" applies to *every script*. The time to move 10 steps 100 times is the time it takes to do nothing 100 times, plus the time it takes to move 10 steps 100 times. So if the time to do nothing was always 0, then our projects would be 0.025 faster per frame in Scratch 1.4, which may seem like a little, but it's actually quite a lot. Sorry if I didn't explain it that well.

Great, Now I'm curious and have to test some of this! Thanks a lot.  tongue


http://mag.racked.eu/cimage/i9002/Sword-In-Back+get%21/HEROBRINE+Y+U+NO+EXIST/mca.png

Offline

 

#5 2012-01-21 00:24:11

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: Flash Player Speed Test Experiment

If there were a featured thread thing I'd nominate this  tongue


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#6 2012-01-21 14:04:28

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Flash Player Speed Test Experiment

My good friend cpumaster930 recently commented on my project telling me that when using turbo mode on the flash player, the times were less than 0.01 second for each. This reminded me that I didn't test the turbo mode for Scratch 1.4 and the flash player. Here are my results:

Scratch 1.4 (Turbo Speed)

Test 1: 0.003
Test 2: 0.033
Test 3: 0.039
Test 4: 0.340
Test 5: 0.147
Test 6: 0.015
Test 7: 0.188

Flash Player (Turbo Mode)

Test 1: 0.000 seconds
Test 2: 0.000 seconds
Test 3: 0.010 seconds
Test 4: 0.000 seconds
Test 5: 0.000 seconds
Test 6: 0.000 seconds
Test 7: 0.010 seconds

What does this mean? The Flash Player is much better at handling turbo mode than Scratch 1.4. This is why graphical projects that involve raycasting and other rendering work very well in the flash player. For example, look at Full Raytracer by Canthiar. This works OK in Scratch 1.4, but it is much faster in the flash player.

Last edited by Lucario621 (2012-01-21 14:09:21)


http://i.imgur.com/WBkM2QQ.png

Offline

 

#7 2012-01-21 14:38:38

Purika
Scratcher
Registered: 2011-01-26
Posts: 100+

Re: Flash Player Speed Test Experiment

catfan8 wrote:

Well the one case when the flash player is faster is the broadcast and wait, which is used a lot more than those other functions like ghost effect or nothing  tongue

You could sticky it!  big_smile


https://lh3.googleusercontent.com/-ZlPXbnYAtro/TxRNNopA6XI/AAAAAAAAAvY/worvlbyfCYI/s589/Purika.gif
If I was three birds, I could see myself fly below us!  big_smile

Offline

 

#8 2012-01-22 09:49:56

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Flash Player Speed Test Experiment

Chrischb wrote:

If there were a featured thread thing I'd nominate this  tongue

There are stickies and iTopics (I haven't forgotten -- check the old block lib).  tongue

Offline

 

#9 2012-01-22 11:17:49

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Flash Player Speed Test Experiment

plus, list operations are SOOOOO much faster in flash player  smile

this project

scratch 1.4: 7.1/1.54
java: 6
flash: 3.3/0.016
big_smile

Offline

 

#10 2012-01-22 12:46:46

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Flash Player Speed Test Experiment

roijac wrote:

plus, list operations are SOOOOO much faster in flash player  smile

this project

scratch 1.4: 7.1/1.54
java: 6
flash: 3.3/0.016
big_smile

Interesting test! You're right. Another examle is this project that I made two years ago; a lot faster in the flash player than in Scratch 1.4.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#11 2012-01-22 13:42:43

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Flash Player Speed Test Experiment

Hm, that's very interesting indeed. Especially the fact that only the Flash player takes no time at all to execute nothing.


Why

Offline

 

#12 2012-01-22 19:46:14

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Flash Player Speed Test Experiment

RedRocker227 wrote:

Hm, that's very interesting indeed. Especially the fact that only the Flash player takes no time at all to execute nothing.

I agree, I was never expecting that.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#13 2012-01-22 20:14:17

cheddargirl
Scratch Team
Registered: 2008-09-15
Posts: 1000+

Re: Flash Player Speed Test Experiment

Indeed, the Flash player seems to run Scratch project faster and better than the current version of Scratch (1.4).

Which makes me wonder about how well projects are going to run in Scratch 2.0 (the offline version).


http://i.imgur.com/8QRYx.png
Everything is better when you add a little cheddar, because when you have cheese your life is at ease  smile

Offline

 

#14 2012-01-22 20:23:05

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Flash Player Speed Test Experiment

@cheddargirl I noticed that too

Also, the test was awesome  smile


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#15 2012-01-22 20:23:40

Dawgles
Scratcher
Registered: 2011-07-29
Posts: 100+

Re: Flash Player Speed Test Experiment

cheddargirl wrote:

Indeed, the Flash player seems to run Scratch project faster and better than the current version of Scratch (1.4).

Which makes me wonder about how well projects are going to run in Scratch 2.0 (the offline version).

Probably pretty much the same, but a tiny bit slower because it'll be drawing the blocks too.

I have big plans for ScratchCraft if the editor runs fast enough to make a level in.

Offline

 

#16 2012-01-22 20:25:16

zippynk
Scratcher
Registered: 2011-07-23
Posts: 500+

Re: Flash Player Speed Test Experiment

I just noticed that if you open a project up in the Experimental Viewer, it's much slower.


https://dl.dropbox.com/u/60598636/trifocal_interlude_soundcloud_button.png

Offline

 

#17 2012-01-23 16:50:42

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Flash Player Speed Test Experiment

cheddargirl wrote:

Indeed, the Flash player seems to run Scratch project faster and better than the current version of Scratch (1.4).

Which makes me wonder about how well projects are going to run in Scratch 2.0 (the offline version).

To my knowledge, they will both be using flash, so it shouldn't make a difference. (Perhaps only slightly faster offline?)

EDIT: Reading Dawgle's post, he has a good point. The block rendering will probably slow down the offline version.

Last edited by Lucario621 (2012-01-23 16:51:31)


http://i.imgur.com/WBkM2QQ.png

Offline

 

#18 2012-02-06 21:12:35

PullJosh
Scratcher
Registered: 2011-08-01
Posts: 500+

Re: Flash Player Speed Test Experiment

Hm... What about doing every block in scratch (yes, I do know how hard that would be) and seeing what kind of blocks work best in each. Like you said, flash seems to be the calculating one. My best guess for java would be display, and I think that scratch would be right in the middle. That way, you could make one of those testers to see what the project is being run in, and make it so that you have to use the best one.


http://www.blocks.scratchr.org/API.php?action=text&string=I'm_on_vacation!&xpos=155&ypos=90&font_size=30&bgimage=http://imageshack.us/a/img339/7215/sspeechsigapiforwords.png

Offline

 

Board footer