On Thu, Jun 9, 2011 at 3:52 AM, Eric Wong <normalperson / yhbt.net> wrote:
> Since you provided the benchmark code, I reformatted and
> made a version of it for kgio (see below).
>
> Summary: ephemeral-class performance noticeably (and will have
> a bigger impact for bigger applications, not small benchmark scripts)
>
> kgio reduces overhead greatly by avoiding exceptions. Real-world
> results (see the dalli README) are less impressive, of course, but still
> noticeable.

Yeah, I'm not surprised by these numbers. In JRuby the cost of EAGAIN
was so great I had to turn off having it generate backtraces;
exception backtraces are much more expensive on JVM (and by extension
JRuby) so flow control based on exception-handling is absolutely
terrible. Only by making EAGAIN backtrace-free could I get reasonable
perf. I'd prefer no exception at all for errnos that are nonfatal.

I will have to try doing something like your ephemeral patch in JRuby.
For us, extending does not flush the global cache, but still has the
cost of creating the singleton class. Not free, but not too bad.

- Charlie