Subject: | Unnecessary string eval in constructor |
When creating a new cache object, as in:
Cache::Memcached::Fast->new
A string eval is done to pull in the Compress::Zlib module. This makes the
constructor a lot slower than it needs to be, in the case where
compression is not used (probably the majority use-case). I have attached
a patch so that this string eval is only performed when compression is
actually needed (e.g. when compress_threshold > 0).
Subject: | Fast.pm.diff |
--- Fast.pm 2012-12-07 14:36:36.000000000 -0500
+++ Fast.pm.old 2012-12-07 14:34:21.000000000 -0500
@@ -565,10 +565,7 @@
_check_args(\%known_params, $conf);
- if (not $conf->{compress_methods}
- and $conf->{compress_compress_threshold}
- and $conf->{compress_compress_threshold} >= 0
- and eval "require Compress::Zlib") {
+ if (not $conf->{compress_methods} and eval "require Compress::Zlib") {
# Note that the functions below can't return false when
# operation succeed. This is because "" and "0" compress to a
# longer values (because of additional format data), and