Introducing Presto

Michael Wynholds ·

Note: If you’re looking for information on Houdini or Toggle, you’re in the right spot. After changing the project name from Toggle to Houdini (for SEO reasons), we’ve switched again (there was another Houdini already). If you know of another language called “Presto” please let us know, we’ve got more names.

At Carbon Five we pride ourselves in crafting amazing web experiences using the best tools and technologies available. Over the years we’ve tried basically every language and framework combo there is. Java & Spring, Ruby & Rails, Python & Django, JavaScript & Node, Go & ??, C# & ASP.NET (OK, not that one), and even Perl & PHP (or that one).

Over the years we’ve noticed that it seems like every day, all day, all our fancy code boils down one basic thing: showing and hiding DIVs. That’s it. Send a bunch of DOM to the browser, then toggle those DIVs on and off. Logged in? Show a DIV. Logged out? Hide a DIV. Click a tab? Yup, another DIV.

So, we’ve gone and done it. We wrote our own language, Presto. And Presto is all about showing and hiding DIVs. Fast. How? Read on. It’s like magic.

presto

The Presto Manifesto

  • It’s super fast at showing and hiding DIVs. See the benchmarks below.
  • It’s both a language and a framework. They’re often confused for one another anyways, so we made it simple.
  • Cross compiles to JavaScript, for now. We’re hopeful the major browsers will support it natively soon.
  • Based on the number one web pattern of all time! MVC.
    • Your Model is the DOM. Use XML, HTML, Web Components or whatever as long as it has lots of < /> (Man, that’s hard to type on an iPhone. Go ahead, try it.)
    • Controller methods must return (and can only return) the special Presto Boolean: show or hide
    • The View is the same as the Model. Think about it. Yes, it’s that simple.

Stuff We’re Still Working On

  • Routing: Should be pretty straightforward
  • Performance: Only affects large datasets. We have some good ideas.
  • Native Browser Support: like we said – coming soon.
  • Documentation: You nagging us is not going to make it go any faster. How about doing something constructive like submitting a pull request?

Stuff Under Consideration

  • Lambdas: I don’t totally understand what these are, but I think we’ll want them. -David
  • Easier selectors: Some of you are complaining about having to use XQuery to select DOM elements to show or hide. We’re considering adding support for Regex.

Code Sample

//div[id=’foo’]/div[class=’login’] => presto()

Motto

Clarity, Simplicity, Deceit.

Spirit Animal

The Cuttlefish

MPA-Cuttlefish
That’s right, O’Reilly. We’re ready.

Benchmarks

Platform Time to show & hide 1,000 DIVs
Chrome 21ms
iOS Webkit 55 ms
Opening & closing my eyes really fast 500 ms*

* I had trouble measuring this because in the middle I passed out. If you count that time, then probably about 6 or 7 hours.

Try it Out!

Michael Wynholds
Michael Wynholds

Mike is the President and CEO of Carbon Five.