logo

Two steps forward, one step back

A Chrome bug takes the Swift out of Swift Calcs

December 1 was an exiting day for the Swift Calcs development team. While running a few routine bug fixes through our unit tests, we noticed something odd:
1+1 took approximately 200 seconds to deliver an answer: 2

Asking a user to take a break (We're calculating...why not get some lunch?) while a very basic computation is performed is not a recipe for a groundbreaking computation engine. We were left scratching our heads...what had we changed? It turns out, nothing. What had changed was our browser.

A lesson in cutting edge

Swift Calcs relies on a new web technology, developed by the fine folks at Mozilla, known as asm.js. Asm.js is revolutionary because it allows web applications to run code at speeds nearly comparable to native applications. Living inside a web-browser no longer has to mean slow when compared with desktop counterparts. The genius of the technology is that the language is a subset of javacsript, the language already used and supported by all the major browsers. Write an application in asm.js, and new browsers can take advantage of the code and run it blazingly fast...come across an old browser without the optimizations, and things still run, just not as quickly. It's that rare new improvement that doesn't break everything for users on older software.

Or is it bleeding edge?

The problem, it turns out, with our systems on December 1 was that our Chrome browsers had automatically updated to the newest version, 47, which was released that day. And Chrome 47 included an update to the javascript engine V8 with one little bug that caused an enormous speed penalty on Swift Calcs: 1+1 in 200 seconds.

New improvements to the javascript engine to take advantage of asm.js features are being rolled in to browsers all the time, and not all browsers are equal. Chrome, it turned out, did not have a test available to catch this particular bug, and it made it out into the wild.

The fix

After diagnosing the problem, we contacted the google chrome dev team and reported the issue. We are happy to report the bug was identified (Find the gory details here) and the issue has been resolved...in Chrome 49, which won't be released until February 29th.

In the meantime, we have instituted a workaround by disabling asm.js optimzation on Chrome, which means Swift Calcs on Chrome will perform computations noticeably slower than Firefox or Safari until Chrome 49 reaches the stable channel at the end of February. Until then, chrome users can work through the sluggishness, work on a different browser, or download Chrome Canary, the development release version which currently includes the bug fix.

The lesson

As a web-based computational engine, we are at the mercy of the platforms on which we run. Although differences and issues arise between browsers (and some bad actors always cause headaches cough IE cough), we have started to use the development releases of various browsers for final unit testing. The hope is that we can find and rectify critical bugs of this nature before they reach wide release in stable products. But for once it was nice to find a problem that wasn't, it turns out, our fault!

comments powered by Disqus