So we use ojspc (Oracle Java Compiler) to compile our JSPs and tag libraries. This saves us the overhead when loading the sites that it needs to parse the JSPs and Tags and thus slows down the initial first hit on a page.
We used to be able to compile an .ear in about 2 hours (which I think was long already). This project has about roughly 130 JSPs and quite some tag libraries. After a redesign of the site the compilation times started to increase, upto 4 hours, 8 hours, … This was making me nervous as it meant we had to stop our sprints sooner … to test sooner … to start building sooner. This is were my quest for the initial problem began.
Why the hell does ojspc take so long to translate my JSPs??
Roughly .. translating a JSP could take upto 2 minutes, with about 130 JSPs, well that easily takes you 2 hours. I started messing around with ojspc.jar seeing if I could call it natively from code, or if I could override a class and maybe play with the internals of ojspc. Not much success here. After monitoring the ojspc process, I saw it was spawning a javac process every once in a while … probably compiling stuff – right? If only I could have a peak there and see what exactly it was doing … and so I did.
I replaced the standard javac binary with a javac bash script which looked more or less like this:
Continue reading ojspc slow compilation and tags being recompiled