BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

Wee: Continuation Based Ruby Web Framework

by Mirko Stocker on Mar 24, 2009 |

Wee (web engineering easy) is a Seaside like web framework that uses continuations and lets the developer "get the job done quick and beautiful", as its developer Michael Neumann writes. Wee also has reusable components, "which are like widgets in a GUI. Once written, you can use them everywhere", targeting componentized HTML GUI applications, rather than RESTish ones. The approaching 2.0 release will also be fully Rack based.

Neumann's blog post about Wee shows some examples how much more readable code with continuations can be. With continuations, a simple sequential flow can be written as:

 callcc page1
 callcc page2
 callcc page3

Compare this to the alternative, written in continuation passing style:

 call page1 do
   call page2 do
     call page3
   end
 end

If continuations are so useful, why isn't every framework using them? A reason why there aren't more continuation based web frameworks for Ruby is certainly that continuations in Ruby 1.8 leak memory. Although Brent Roman's MBARI patches fix the memory leak, they aren't yet in the official Ruby 1.8 series (they might get included once Engine Yard assumes the maintenance). With Ruby 1.9.1, the memory leaks are also gone and Wee takes advantage of that:

For 10000 requests (with one thread) Ruby 1.9.1 takes 16 seconds and requires 12 MB of memory. The same example with Ruby 1.8.7 grows to 329 MB of memory and takes 56 seconds

Wee seems to be a good reason to start switching to Ruby 1.9 and also an interesting alternative to Rails, now that Merb will be merged into Rails 3.0.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

git repository does not include all files? by G Cao

I cloned git repository and was able to run examples/demo.rb However when I run examples/ajax.rb, it requires lib/jquery/jquery which seems not existing. Does git repository miss some files?

Re: git repository does not include all files? by Mirko Stocker

Does git repository miss some files?


I'd contact the author of Wee, Michael Neumann.

Re: git repository does not include all files? by G Cao

Just emailed him. Thanks.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

3 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT