Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Zotonic's fork of Basho's webmachine
Erlang JavaScript CSS Shell
branch: master

Performance enhancement.

Calling module_info/0 one time is much more expensive than calling

From: eprof:

erlang:function_exported/3       22  0.25     7  [      0.32]

erlang:get_module_info/2         1  7.22   267  [    267.00]

Last two numbers are time in and time per call (uS).
latest commit cfbdd16f4f
@mmzeeman mmzeeman authored
Failed to load latest commit information.
docs Added empty dirs. Recovered default config file.
ebin resource -> controller
include Performance enhancement.
priv Compiles.
scripts Added r1392 from Zotonic svn
test Merged auto_location patch from Basho Webmachine
trace Added r1392 from Zotonic svn
www Added webmachine c25ec2dfaba2 tip from…
.gitignore Add .rebar to .gitignore
Emakefile Added r1392 from Zotonic svn
LICENSE Added r1392 from Zotonic svn
Makefile Compiles. More notes.
THANKS Added Arjan and Ben. (github f8a2ef2c62bc61a76aab)
rebar Fix length return value problem in send_parts
rebar.config Remove errors-as-warnings flag. Fix scripts Fix scripts


Zotonic's Variation

This is a fork of Basho's Webmachine. This fork is done for supporting content management systems with large amounts of dispatch rules and many virtual hosts.

Differences with Basho Webmachine

The main differences with Basho's Webmachine are:

  • Pluggable dispatch handler
  • Support for the HTTP Upgrade
  • Caching of resource callbacks results
  • Dispatch handler can redirect requests
  • Use of process dictionary has been removed
  • webmachine_request is now a normal (non parametrized) module
  • Resources are renamed to controllers.
  • webmachine_controller (ie. webmachine_resource) is now a non-parametrized module
  • Extra logging, also in the event of crashes
  • Use of os:timestamp() instead of now() to prevent locking and time shifts

The first couple of changes gave a significant speed boost to Webmachine.

In the specific case of Zotonic the difference was 5 milliseconds (or more) per request (on a 2GHz Core 2 Duo). Without these optimizations we were not able to use Webmachine.

Something went wrong with that request. Please try again.