subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1476554 - in /subversion/trunk/subversion/libsvn_subr: cache-inprocess.c cache-membuffer.c cache-memcache.c cache.c cache.h
Date Sat, 27 Apr 2013 11:11:17 GMT
Author: danielsh
Date: Sat Apr 27 11:11:16 2013
New Revision: 1476554

URL: http://svn.apache.org/r1476554
Log:
Followup to r1461689: reduce the overhead of maintainer builds.

Specifically, instead of a getenv() upon every cache access, do that just
once at cache creation and store the result.

Suggested by: stefan2

* subversion/libsvn_subr/cache.h
  (svn_cache__t.pretend_empty): New member.

* subversion/libsvn_subr/cache.c
  (svn_cache__get, svn_cache__iter, svn_cache__get_partial):
    Update the maintainer-mode-only "pretend empty?" condition.

* subversion/libsvn_subr/cache-inprocess.c
  (svn_cache__create_inprocess),
* subversion/libsvn_subr/cache-membuffer.c
  (svn_cache__create_membuffer_cache),
* subversion/libsvn_subr/cache-memcache.c
  (svn_cache__create_memcache):
    Initialise "pretend_empty".

Modified:
    subversion/trunk/subversion/libsvn_subr/cache-inprocess.c
    subversion/trunk/subversion/libsvn_subr/cache-membuffer.c
    subversion/trunk/subversion/libsvn_subr/cache-memcache.c
    subversion/trunk/subversion/libsvn_subr/cache.c
    subversion/trunk/subversion/libsvn_subr/cache.h

Modified: subversion/trunk/subversion/libsvn_subr/cache-inprocess.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cache-inprocess.c?rev=1476554&r1=1476553&r2=1476554&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cache-inprocess.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cache-inprocess.c Sat Apr 27 11:11:16 2013
@@ -642,6 +642,7 @@ svn_cache__create_inprocess(svn_cache__t
 
   wrapper->vtable = &inprocess_cache_vtable;
   wrapper->cache_internal = cache;
+  wrapper->pretend_empty = !!getenv("SVN_X_DOES_NOT_MARK_THE_SPOT");
 
   *cache_p = wrapper;
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cache-membuffer.c?rev=1476554&r1=1476553&r2=1476554&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cache-membuffer.c Sat Apr 27 11:11:16 2013
@@ -2362,6 +2362,7 @@ svn_cache__create_membuffer_cache(svn_ca
   wrapper->cache_internal = cache;
   wrapper->error_handler = 0;
   wrapper->error_baton = 0;
+  wrapper->pretend_empty = !!getenv("SVN_X_DOES_NOT_MARK_THE_SPOT");
 
   *cache_p = wrapper;
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_subr/cache-memcache.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cache-memcache.c?rev=1476554&r1=1476553&r2=1476554&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cache-memcache.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cache-memcache.c Sat Apr 27 11:11:16 2013
@@ -407,6 +407,7 @@ svn_cache__create_memcache(svn_cache__t 
   wrapper->cache_internal = cache;
   wrapper->error_handler = 0;
   wrapper->error_baton = 0;
+  wrapper->pretend_empty = !!getenv("SVN_X_DOES_NOT_MARK_THE_SPOT");
 
   *cache_p = wrapper;
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_subr/cache.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cache.c?rev=1476554&r1=1476553&r2=1476554&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cache.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cache.c Sat Apr 27 11:11:16 2013
@@ -76,7 +76,7 @@ svn_cache__get(void **value_p,
      out with FOUND set to false. */
   *found = FALSE;
 #ifdef SVN_DEBUG
-  if (getenv("SVN_X_DOES_NOT_MARK_THE_SPOT"))
+  if (cache->pretend_empty)
     return SVN_NO_ERROR;
 #endif
 
@@ -119,7 +119,7 @@ svn_cache__iter(svn_boolean_t *completed
                 apr_pool_t *scratch_pool)
 {
 #ifdef SVN_DEBUG
-  if (getenv("SVN_X_DOES_NOT_MARK_THE_SPOT"))
+  if (cache->pretend_empty)
     /* Pretend CACHE is empty. */
     return SVN_NO_ERROR;
 #endif
@@ -146,7 +146,7 @@ svn_cache__get_partial(void **value,
   out with FOUND set to false. */
   *found = FALSE;
 #ifdef SVN_DEBUG
-  if (getenv("SVN_X_DOES_NOT_MARK_THE_SPOT"))
+  if (cache->pretend_empty)
     return SVN_NO_ERROR;
 #endif
 

Modified: subversion/trunk/subversion/libsvn_subr/cache.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cache.h?rev=1476554&r1=1476553&r2=1476554&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cache.h (original)
+++ subversion/trunk/subversion/libsvn_subr/cache.h Sat Apr 27 11:11:16 2013
@@ -99,6 +99,10 @@ struct svn_cache__t {
 
   /* Total number of function calls that returned an error. */
   apr_uint64_t failures;
+
+  /* Cause all getters to act as though the cache contains no data.
+     (Currently this never becomes set except in maintainer builds.) */
+  svn_boolean_t pretend_empty;
 };
 
 



Mime
View raw message