[web-devel] Performance of Yesod 0.7 fourteen times slower than Rails 2.3?

Aur Saraf sonoflilit at gmail.com
Wed Mar 23 23:08:02 CET 2011

On Wed, Mar 23, 2011 at 9:47 AM, Michael Snoyman <michael at snoyman.com> wrote:
> I would definitely appreciate some help with the PostgreSQL backend.
> Here's the basic game plan I have in mind right now:
> * Split out the TH code into a separate package. This will be done for
> a 0.5 release.
> * Review Aur's join code. Most likely that will get included immediately.
> * Switch over the PostgreSQL backend from HDBC to the PostgreSQL C API.


No no no no no. My code definitely cannot be included immediately.

It is a proof of concept. It is very rough around the edges. It
doesn't fully support the little that it's supposed to (e.g., count on
joins isn't supported yet, although it is 10 minutes of work away); it
probably breaks a few things, as I hacked away at the persistent code;
it isn't well structured - the architecture should be changed so that
non-relational databases could be supported as well; and there's many
more features that should be added into the API before we seal and
release it.

My code was released in order to get feedback (and perhaps also
patches) before I continue refining it, as it is the most complicated
code I have written in Haskell yet and I feel like I need some

To those who aren't aware of my code:

In my use of yesod, the thing that slows my code the most by far is
the lack of support for JOINs in SQL. Joining data from different
tables can be a very slow operation, and databases are heavily
optimized to perform it. Reimplementing JOIN in Haskell using just
single-query support is orders of magnitude slower.

That, and it being a repeating task, are why the community started
discussing adding API for JOIN to persistent, that would be
implemented at the DB for SQL databases and in Haskell for
non-relational databases that don't support JOIN natively, and why I
submitted a PoC for it.

I'd be very glad to accept critique and/or help.

Here is some relevant performance advice by a postgresql core team
member: http://planet.admon.org/postgresql-database-performance-tips/.

 -- Aur

More information about the web-devel mailing list