I have a really simple taglib and service:
class TestTagLib {
FooService fooService
static namespace = "bar"
def test = {
out << "text"
}
}
class FooService {
//This is an empty method that does absolutely nothing
void foo() { }
}
If I repeat this taglib 20 times on a page, it executes instantly. But now if call that service:
...
fooService.foo()
out << "test"
...
Suddenly those 20 taglibs cause the page to take 2 seconds to load. This doesn't seem right that the overhead of a service call would be so high...or is it? How would I even go about debugging this?
Service methods are by default transactional. So, for every call of fooService.foo()
you are getting the overhead of a complete database transaction creation and commit.