Did these guys just reinvent the Web?

San Francisco startup Famo.us builds a more dynamic runtime for JavaScript applications

Steve Newcomb and Mark Lu had hit a wall. The co-founders had raised $1.1 million for their startup -- "sort of Pinterest meets About.me meets Facebook," says Newcomb. They'd been toiling long hours to build everything in HTML5, lured by the advantages of maintaining a single code base across all platforms.

They burned through $400,000 before they realized that HTML5 wasn't ready for the type of dynamic UI they wanted to create, which was around the same time that Facebook's Mark Zuckerberg publicly reached the very same conclusion. Browsers were meant to render text documents with links; trying to build a JavaScript app as slick and responsive as, say, a native iOS app was an exercise in futility. "We realized we either needed to give the money back or do something radical," Newcomb recalls.

Newcomb was the grizzled startup veteran whose most successful company, the natural-language search venture Powerset, had sold to Microsoft for $100 million to become part of Bing. Lu was a full stack engineer who, being just 21 years old, didn't mind attempting "things that would be Crazy Town for other people," as Newcomb puts it.

As recounted by Newcomb, a conversation between the two founders ensued that set the pair on a different path to a new startup -- a venture dubbed Famo.us that intends to empower JavaScript developers to build much more dynamic apps.

"Facebook is right. HTML5 isn't ready," sighed Newcomb.

"The fact is, it's the wrong tool," said Lu, referring to the renderer within the browser. "We're years away from this being fixed."

"I feel like we're working with a car that has a lawn mower for an engine. We need a better engine. What we really need is to create our own renderer. Like Flash, but without the need for a plug-in...and in JavaScript."

"Hmm. Yeah. Hmm. Why can't we do that?"

"What? JavaScript would be an awful slow renderer. Also, how do we circumvent the browser's renderer in JS? We're not going to use some plug-in. That would be death."

Lu thought for a little while. "I think we may already have a solution to both of those concerns. To fix the rendering problem, the primary part we need to rewrite is the part of the renderer that creates and multiplies the matrices. And luckily for us, JavaScript is about 80 percent of the speed of compiled C for those specific types of operations."

"That should give us a big advantage. How big?"

Lu did some quick calculations. "Possibly an order of magnitude."

Newcomb's jaw dropped. "That's ... really good. But how do we circumvent the browser's renderer without a plug-in?"

"We use the CSS3 primitive -webkit-transform: matrix3d, which lets us compute the composite matrix and skip the browser's renderer. No plug-in, no download, no hack. By appending this to each DIV, we can render the composite matrix and go straight to the GPU."

"Um, that sounds like really hard stuff."

"Not really. I'll have it done by tomorrow."

In short order, Lu was able to construct a simple test where a box was rendered swooshing across the screen. In the first run, Lu did it the conventional HTML5 way. In the second run, he used the new JavaScript rendering engine he'd coded. "We were 14 times faster than compiled C in Chrome in the very first test with only a 65K footprint," says Newcomb. "And I was like: That's huge. Done! Let's build a franchise around this."

Lu and Newcomb didn't stop there and began addressing other performance bottlenecks. For one thing, Lu felt jQuery constructed the rendering tree the wrong way around and opted to emulate the way games handled rendering instead. CSS3 animations were sorely limited, but the gaming industry had long ago mastered performance and motion in a much more advanced way using physics.

The Famo.us core is made up of four engines written in pure JavaScript: the rendering engine; a physics engine to control motion; a gesture engine for touch, mouse, keyboard, and Leap Motion; and a multiscreen engine that enables developers to parse out the app to any number of displays. Together these form a new, high-performance runtime environment for Web apps, mobile apps, or any apps coded in JavaScript.

As it turns out, the matrix3d transform is a W3C standard that must be supported by all browsers, so Famo.us apps such as this home page demo require no plug-ins. Moreover, rendering goes through DOM (Document Object Model), so all text in Famo.us applications is searchable (the company says it can now use the Canvas and WebGL elements of WebKit as well). Speeds of up to 60 frames per second can be achieved, depending on the platform. So far Famo.us will run on Chrome, Safari, or Firefox browsers (IE will come later) and even on hardware as wimpy as the iPhone 3.

Along with the four engines that comprise the Famo.us core, the company has developed templates to enable rapid application development. Last month Famo.us announced that its core would be available for free under an as-yet-unspecified open source license when the company releases its software sometime next year. Ultimately, Newcomb hopes the Famo.us core will become a part of WebKit.

Famo.us plans to make money by offering app templates and widgets (some free, some paid) along with selling hosting, analytics, and monitoring among other operations services. Enterprises will be offered a license that lets them "tap the engines directly and gives them tools to obfuscate their code to the nth degree," says Newcomb.

What sort of Famo.us apps might appeal to enterprise developers? The most obvious answer is simply that Famo.us supports a smooth, high-functioning UI across all platforms using a single code base. Personally, I think Famo.us will become one of several enabling technologies that gives enterprise developers the tools they need to stay relevant and produce public-facing mobile and Web applications that meet or exceed the high expectations of consumers. I can also imagine new types of apps that allow enterprise users to touch-interact with big data analytics -- or, more broadly, might even spark a new breed of gamified enterprise apps.

Famo.us completed a $4 million series A round in March and has hired only 10 people to date, including Dave Fetterman, former mobile engineering manager for Facebook. The company will shortly be embarking on its first closed beta program, where 40 developers will camp out in Famo.us's San Francisco offices to build apps. According to Newcomb, over 60,000 developers have already applied for betas.

Obviously, this isn't exactly the reinvention of the Web, but Famo.us has pushed JavaScript in a novel direction -- and has poked a large hole in the argument that native apps alone deliver the goods. It will be fascinating to see the new types of applications that emerge.

This article, "Did these guys just reinvent the Web?," originally appeared at InfoWorld.com. Read more of Eric Knorr's Modernizing IT blog. And for the latest business technology news, follow InfoWorld on Twitter.

This story, "Did these guys just reinvent the Web?" was originally published by InfoWorld.