Friday, April 22, 2011

Sundae - 1.0 - XB-pointstream and other unfinished business

My usual rant: Sundae is a canvas reference tester library built in Javascript. My goal is get Processing.js, c3dl, and XB-pointstream to use this tool, but that's just the start who knows what else.

Since we only care about links, eat your hearts out.


1.0 is done I guess I can breathe a sigh of relief, not.

In my last post I went on and on about this thread pool manager, it wasn't until yesterday I found a major bug, where finished workers were never set to available. The answer was more closures! I needed to keep a local reference of itself, within its onmessage, see it here.


After a few stressful hours before I moved out of my house @ York university. Andor Salga and I were hard at work debugging Sundae to work with XB-PointStream. Eventually there was a light at the end of the tunnel, things clicked, my threads lined up and THAT round of bugs was ironed out. Library goal 1, reached. 2 more at Seneca to go.

Whats new with Sundae?
  • Error messages displayed in console on malformed test cases
  • Thread pooler actually works now!
  • Added known fail, counts as a pass
  • Added a progress counter
  • Added some pretty buttons on the page
  • Blurring doesn't cause strange artifacting anymore
  • 3D canvases compared properly, this one was a doozy

OSD700 comes to an end

This has been my favourite and most challenging course to date, the concept of open source technology to a student was so foreign. We're encouraged to take what others have done before us and put our spin on it, in a world where you hear the doom and gloom of academic dishonesty every semester. David Humphrey, Seneca's resident open source teaching bad-ass was inspirational and insightful as ever throughout my experiences in this course. I don't think I'll ever part from open source development after being introduced to the its world. Even if programming stops being a career it's now always a hobby.

Contribute Input

Monday, April 18, 2011

0.9 - Sundae - Gets buff - threadpool

For anyone who doesn't know Sundae, is a canvas reference tester library built in Javascript. My goal is get Processing.js, c3dl, and XB-pointstream to use this tool.

Skip the blog:

The bulk
After my initial 0.8 release where I dabbled into the world of web workers, Sundae still had massive performance hogs.

What did I do about it? I went on IRC and spoke to the community! David Humphrey provided some interesting insights on my issue. My problem was that although I was now using web workers my code was STILL synchronous. The solution became, remodel the workers to grab work items from a queue.

So including edge cases, my workflow became:
  • queue.push called, is there a available worker?
    • Yes -> use it
    • No -> add to queue
  • worker.onmessage, are there more items to work on?
    • Yes -> do it
    • No -> make worker available
I so happy when not only did this code work, the runtime when down to 1s from 5s on my calibration tests on a Quad core machine! Although on my much slower aging laptop the performance gain was less dramatic still halving the runtime.

Get the threadpool code here
and use it like this:


But from the pastebin you'll need to change onnmessage

onmessage = function(data){
...Does something meaningful with your returned data...

Help me out!

Monday, April 11, 2011

0.7 and 0.8 - Dual release, now with moar web workers

For anyone who doesn't know Sundae, is a canvas reference tester library built in Javascript. My goal is get Processing.js, c3dl, and XB-pointstream to use this tool.

What's new?

Blurring is. Blurring is the basically smudging the image, the reason any tester needs this is because colours will render differently on different browsers. So if you took a reference screen shot and compare it to a real time render often times during an exact pixel comparison there will be slight variations. So in order to remove these useless errors I added two things. I stole all of my blurring logic from the Kraken javascript benchmarker here. Then I happily thrifted through the code that birthed Sundae, the Pjs ref tester and took their comparison logic.

So in short what's new is that a majority of the heavy lifting and work in the libraries engine is done. Now that compare and blurring are working I can take a sigh of relief.

The Unsung Hero's

Finally this project has web workers, why are they good? because it's the equivalent of putting something on the back burning and forgetting about it until you remember and its perfectly cooked the next time you look at it. Having the ability to throw the work into a background process is great. The best part is you don't lose control of your browser.

 Using web workers is pretty simple to boot, I setup a worker pool in my main thread and each worker roughly looks like this.

 var worker = new Worker("blah.js");
worker.onmessage = function (event) {
worker.postMessage("meaningful data"); 

Meanwhile in blah.js

onmessage = function (event) { //the data throw in during mains postmessage 
postMessage("throwing back response"); 

So main posts data to the worker, the worker gets it in it's onmessage and the original data is accessed by looking at When the worker is done is throws data back to main by calling postMessage, where the onmessage is main catches it.

Really Unsung Hero's

The other features I put in for these releases such as finally making the test tags working. Marking the end in an era where I had options on the front page of index.html that never did anything. Additionally getting to features that my one user so far wanted! Notes per test to display additional text during run time. Lastly, this option I spent a better part of Friday afternoon hacking together. Allowing the user to see the blurred pixel results on their original canvases as seen below.

Some Problems

I need help! Look at my thread pool in Sundae.js  I want each blurring to use its own worker thread. Right now the blur worker is blurring both canvases. I cannot not figure out how to get both of these threads running asynchronously and actually blurring the right canvases. If anyone has design advice drop a bug at lighthouse or comment below.

Friday, April 8, 2011

ECL500 - Drawsy

Dave Seifried and I created a simple paint application for the Blackberry. We made this application to be our culminating project in ECL500, the purpose of the course was to explore Eclipse as a development environment and ultimately use its tools to make something cool!

The Problems
An on going problem is combating the low frame rate environment. Since our draw function is called every frame often times a long sweeping motion leaves gaps because the motion took place between screen refreshes. Unfortunately this problem only gets worst the deeper our stack depth gets.

The Evolution
Originally we were going to port Processing to use RIM's awt implementation this proved to be quite the hassle, then we thought of using Processing.js, which was the reason I made this demo but the in ability to open local .html files and not wanting to rely on a network connection cut that dream short.

Either way here's your exclusive sneak peak at our demo.

Optimizations in the Works
  • Swipe the draw from the previous screen to the current
  • Draw on a back buffer
  • Better control of the screen stack