How to avoid Play Framework killing performance

Note: This article is about Play Framework 1.2.x and might not apply to Play 2.x projects.

The other day I had to convert some code from C to Java. This code runs some pretty simple calculations, using a few classes as data-holders, and running a few thousand iterations. I had to get this working as part of the backend for a Play Framework web application.

In C the code would run blindingly fast, and return the results within 10-20 milliseconds. All good!

After a couple of hours of converting the code and fixing the pointer/reference/initialization oddities between Java and C, I got the code running. Well, more like walking, or lazily sauntering along. The Java code took 4 seconds to run. I know Java is perceived to be slow, but my experience with it was telling me that there is no way it should be so slow.

Continue reading “How to avoid Play Framework killing performance”