-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|622|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Blogs Home -> Blogs


 
JL235
Created : 08 March 2011
Edited : 08 March 2011
System : Mac

PlayMyCode updates!



Today I have three new updates out for PlayMyCode, YAY!

First a new forum so you can ask for help and discuss other stuff too.

Second a new blog so you can read about PlayMyCode and new PMC stuff in the pipeline (first post is being written as I type).

Finally everything is much faster! Compilation is about 4 times faster and games run much smoother. Space Snake Galaxies is finally playable in a smooth state on my machine in FireFox!

It's great that the site is really starting to come along. Core features are finally falling into place, like we've started on the users page too. But we have great ideas on how to improve it further in the future. So I invite you all to go check out PlayMyCode (again) and enjoy it!

 

Comments


Tuesday, 08 March 2011, 15:29
Jayenkai
Hurray!! Finally a blog that I can nick content from, each Friday
Tuesday, 08 March 2011, 15:35
HoboBen
Wow, I am impressed with how well its working on Firefox now. Was there anything special you did to do that, or was it just a case of optimising what you had already?
Tuesday, 08 March 2011, 16:07
JL235
The games are now embedded within an iFrame on PMC. This means that FireFox doesn't render the rest of the page underneath underneath the canvas such as box-shadows or gradients (which is was doing).

Secondly I profiled the compilation process and found two main issues. First I was using concat as a clean way to join two arrays together because it's very elegant to do so. However it's _much_ cheaper to iterate over an array and manually push each element onto the other. Turns out you should only use concat if you actually need a new copy of the array, which I didn't.

The second thing that was taking a lot of time was 'Array.prototype.slice(arguments)' which is the way suggested online to turn an 'arguments' object into an Array object (for those who don't know the arguments object is a fake array that contains all of the parameters passed into a function, but the trouble is that it's not actually a real array).

Using slice is fast for copying large arrays however it's very rare that you have more then 10 parameters passed into a function. With very small arrays (less then 10 items) it's much faster to just make a new array and push each element onto it.

Finally when you run JS the page will freeze until the JS has finished running. This is because no event's can run, because they can trigger more JS (which the running JS is blocking). This also blocks things like gif animations and JQuery fades. The solution is to use 'setTimeout' to run your code as multiple functions seperated by a couple of milliseconds.

The Quby compiler now uses a special library (called util.future) which I wrote for running multiple functions automatically with setTimeout (it's only about 100 lines). I also changed the front-end of the compiler (only another 100 lines) so it now breaks up the high level parts into seperate function calls, each seperated by 10 milliseconds of breathing space.

In short this means the Quby compiler locks the browser up for much shorter periods of time, allowing the browser to smoothly fade into the compilation process and then fade out.
Wednesday, 09 March 2011, 03:51
Jayenkai
Your blog is void and empty. ^ Post that to your blog!
Wednesday, 09 March 2011, 05:04
JL235
My brother was supposed to write the first blog post last Sunday. If he doesn't get it done within a few hours I'll post that as our first.

Otherwise I'll write that up and post it laterz in the week.
Wednesday, 09 March 2011, 07:53
JL235
First post is done! Expect a detailed JS game optimization post in a few days.
Wednesday, 09 March 2011, 08:15
Jayenkai
woot!