{"id":270,"date":"2014-06-13T16:00:27","date_gmt":"2014-06-13T14:00:27","guid":{"rendered":"http:\/\/heppg.de\/ikg\/wordpress\/?p=270"},"modified":"2014-10-08T21:01:42","modified_gmt":"2014-10-08T19:01:42","slug":"raspberry-optimized-scratch-performance-beta4","status":"publish","type":"post","link":"https:\/\/heppg.de\/ikg\/wordpress\/?p=270","title":{"rendered":"Raspberry optimized scratch, performance beta4"},"content":{"rendered":"<p>Since some weeks, a new beta scratch version for RPi is around, announced on <a href=\"http:\/\/www.raspberrypi.org\/blog\/page\/2\/#test-tims-nuscratch-beta\">raspberrypi.org<\/a>.<\/p>\n<p>The work done by Tim Rowledge is in the area of performance. First impression is &#8216;it is faster&#8217; in editing and runtime. So it is time to measure some performance numbers.<\/p>\n<p>I measured timings for three systems:<\/p>\n<ul>\n<li>RPi-1.4-scratch is current scratch\/squeak as on raspian, clocked at 1GHz.<\/li>\n<li><span style=\"color: #0000ff;\">RPi-1.4-beta<\/span> is current version of beta scratch (2014-06-13).<\/li>\n<li>win-1.4-scratch: To compare with a more powerful system, I have run some of the tests on a laptop machine, running scratch 1.4 from scratch.mit.edu, windows 7, 4 core processor 2.2GHz<\/li>\n<\/ul>\n<p>Update: jamesh asked to repeat the tests with &#8216;HW cursor implementation for X&#8217; xf86-video-fbturbo &#8211; video driver. Sounds complicated, but installation was straightforward. The tests executed with this modified X-system are marked with &#8216;X&#8217;<\/p>\n<ul>\n<li>RPi-1.4-scratch-X, modified X\u00a0 running RPi-1.4-scratch<br \/>\nRPi-1.4-beta-X , modified X running RPi-1.4-beta.<\/li>\n<\/ul>\n<p>Results<\/p>\n<p>In loops and calculations, the new scratch version on RPi even outperforms my windows-machine running legacy-1.4-scratch from mit.edu. On Pi, it needs only 50% execution time compared to current pi-scratch. This is impressive good.<br \/>\nFor the other tests, execution time is down to some 85%, 80%.<\/p>\n<p>One exceptional improvement is in these cases where variables are displayed on stage. This slows down current scratch, but in beta and with the modified X it executes 1o times faster (move2_presentation).<\/p>\n<p>Especially for the graphic operations, improvements are noticeable.<\/p>\n<p><a href=\"http:\/\/heppg.de\/ikg\/wordpress\/wp-content\/uploads\/2014\/06\/performance_summary_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-284\" src=\"http:\/\/heppg.de\/ikg\/wordpress\/wp-content\/uploads\/2014\/06\/performance_summary_2.png\" alt=\"performance_summary_2\" width=\"764\" height=\"463\" \/><\/a><\/p>\n<p>The results are blue, dark yellow for raspbian system, and light blue, light yellow for the modified driver.<\/p>\n<p>The modified driver in X results in better performance, execution times are 0.8 times only in most cases. The quite simple rotate and move-examples do not benefit too much, but whenever it gets crowded on stage it is noticeable.<\/p>\n<p>For scratch remote sensor connections, the improvements are not so impressive and I assume it is based on overall performance optimizations. But the tests show that remote connections for broadcasts or variables need 40 ms for sending or receiving. Which is not bad. The great improvement in pingpong_remote is due to the comparison of presentation mode operations. Here, the RPi-1.4-scratch is much slower in presentation mode. Compared with full-stage mode, this is in the 80% range of other results.<\/p>\n<p>The scratch projects are in <a href=\"http:\/\/heppg.de\/ikg\/wordpress\/wp-content\/uploads\/2014\/06\/performance1.zip\">performance<\/a>.zip.<br \/>\nFor the scratchClient, see <a title=\"scratchClient Download\" href=\"http:\/\/heppg.de\/ikg\/wordpress\/?page_id=6\">download page.<\/a><\/p>\n<h2>Graphic system (performance_rotate.sb)<\/h2>\n<p>Rotating sprites needs quite a lot of computation power. It needs rotating the sprite by an angle and redisplay the graphics. In order to avoid possible caching of calculated sprite graphics, I have choosen to apply extra &#8216;one degree&#8217; rotations in between.<\/p>\n<p>RPi-1.4-scratch\u00a0 10.6 sec<br \/>\n<span style=\"color: #0000ff;\">RPi-1.4-beta<\/span> 8.5 sec<\/p>\n<h2>Graphic system 2 (performance_rotate_say.sb)<\/h2>\n<p>Displaying the &#8216;say&#8217;-bubble is a challenge. The system needs to look for the solid icon inside the alpha background, and adjust the bubble accordingly.<\/p>\n<p>RPi-1.4-scratch\u00a0 22.5 sec<br \/>\n<span style=\"color: #0000ff;\">RPi-1.4-beta<\/span> 14.0 sec. This is impressive good.<\/p>\n<p>win-1.4-scratch 6.0 sec<\/p>\n<h2>Graphic system move, move2<\/h2>\n<p>The move sample I usually explain to the kids in school as a scratch-antipattern: while true; goto x,y; inc x; inc y; endwhile; This works, but movement speed is limited by cpu-usage. The second is movement of two sprites with variable display on stage. This slows down execution speed drastically in RPi-1.4-scratch. In this area, the beta is a class better.<\/p>\n<p><a href=\"http:\/\/heppg.de\/ikg\/wordpress\/wp-content\/uploads\/2014\/06\/move2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-285\" src=\"http:\/\/heppg.de\/ikg\/wordpress\/wp-content\/uploads\/2014\/06\/move2.png\" alt=\"move2\" width=\"245\" height=\"202\" \/><\/a><\/p>\n<p>The presentation mode timings are<\/p>\n<p>RPi-1.4-scratch 159.4 sec<br \/>\nRPi-1.4-scratch-X 119.2 sec\u00a0 using the modified X driver<\/p>\n<p>RPi-1.4-beta 17.6 sec.<br \/>\nRPi-1.4-beta-X 14.3 sec\u00a0 using the modified X driver<\/p>\n<p>&nbsp;<\/p>\n<p>win-1.4-scratch 12.1 sec<\/p>\n<h2>Scratch Sensor Network performance (performance_pingpong_remote.sb)<\/h2>\n<p>There are many assumptions on remote access for scratch timings. So I took the opportunity to measure some values.<\/p>\n<p>It is not possible to measure time from a broadcast in scratch till it arrives in a remote system. It would need software &#8216;instrumentation&#8217; inside scratch. But it is possible to send out a broadcast, and wait for a response coming back, using a remote scratchClient.<\/p>\n<p>For the test, scratch script sends broadcast &#8220;ping&#8221;, and my scratchClient-software responding with &#8220;pong&#8221;. In scratch, this is repeated 200 times and time recorded.<\/p>\n<p>RPi-1.4-scratch fullscreen 30.3 sec (!)<br \/>\nRPi-1.4-scratch edit mode 18.4 sec<\/p>\n<p><span style=\"color: #0000ff;\">RPi-1.4-beta<\/span> fullscreen 16 sec.<\/p>\n<p>The legacy scratch in fullscreen needs much longer than in edit mode, although the script animations cost some time. Strange.<br \/>\nThe new scratch is 10 percent faster.<\/p>\n<p>What does this mean on IO-Performance ? One event out, one in in 16sec\/200 = 80ms or one way in 40ms. This is much faster than reported elsewhere. Not to forget: nothing else running around, no animations or alike.<\/p>\n<p>When you want to run this test on your machine, load my scratchClient software, and use command line<\/p>\n<pre>cd ~\/scratchClient\r\nsudo python src\/scratchClient.py -c config\/config_pingpong.py<\/pre>\n<h2>Scratch Sensor Network performance (performance_pingpong_sensor_remote.sb)<\/h2>\n<p>Similiar setup as in the broadcast example, but there are variable values send over the network.<\/p>\n<p><a href=\"http:\/\/heppg.de\/ikg\/wordpress\/wp-content\/uploads\/2014\/06\/analog.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-271\" src=\"http:\/\/heppg.de\/ikg\/wordpress\/wp-content\/uploads\/2014\/06\/analog.gif\" alt=\"analog\" width=\"246\" height=\"257\" \/><\/a><\/p>\n<p>When scratchClient receives the &#8216;a&#8217;-value, it increments it by &#8216;1 and sends it back.<\/p>\n<p>RPi-1.4-scratch 77.1 sec<br \/>\n<span style=\"color: #0000ff;\">RPi-1.4-beta<\/span> 67.2 sec<\/p>\n<p>win-1.4-scratch\u00a025.0 sec<\/p>\n<p>These values are very close to the broadcast-timings.<\/p>\n<p>The scratchClient is same as for the broadcast test.<\/p>\n<h2>Scratch Calculations (performance_calculations.sb)<\/h2>\n<p>Simply a loop, and a few calculations.<\/p>\n<p>RPi-1.4-scratch 41.3 sec<br \/>\n<span style=\"color: #0000ff;\">RPi-1.4-beta<\/span> 20.7 sec (checked twice, real fast)<\/p>\n<p>win-1.4-scratch\u00a025.0 sec<\/p>\n<h2>Scratch Broadcasts (performance_pingpong.sb)<\/h2>\n<p>Sending broadcasts inside scratch. Remote sensor connections are disabled, and code is executed in presentation mode to avoid the script animations during executions.<\/p>\n<p>RPi-1.4-scratch 83.0 sec presentation screen<br \/>\nRPi-1.4-scratch 75.0 sec full stage screen<\/p>\n<p><span style=\"color: #0000ff;\">RPi-1.4-beta<\/span> 41.9 sec presentation screen<br \/>\nRPi-1.4-beta 84.5 sec full stage screen<\/p>\n<p>win-1.4-scratch\u00a050.0 sec<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since some weeks, a new beta scratch version for RPi is around, announced on raspberrypi.org. The work done by Tim Rowledge is in the area of performance. First impression is &#8216;it is faster&#8217; in editing and runtime. So it is time to measure some performance numbers. I measured timings for three systems: RPi-1.4-scratch is current [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-270","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/heppg.de\/ikg\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/270","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/heppg.de\/ikg\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/heppg.de\/ikg\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/heppg.de\/ikg\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/heppg.de\/ikg\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=270"}],"version-history":[{"count":9,"href":"https:\/\/heppg.de\/ikg\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/270\/revisions"}],"predecessor-version":[{"id":287,"href":"https:\/\/heppg.de\/ikg\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/270\/revisions\/287"}],"wp:attachment":[{"href":"https:\/\/heppg.de\/ikg\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/heppg.de\/ikg\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/heppg.de\/ikg\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}