tasn pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=9686e44b927744afa6b230c31cf64cf005e45484

commit 9686e44b927744afa6b230c31cf64cf005e45484
Author: Tom Hacohen <t...@stosb.com>
Date:   Thu Oct 15 17:51:20 2015 +0100

    Eo unref: Decrease amount of checks and hint branch prediction.
    
    This may look minor, but this is such a hot path, that this actually
    speeds things up a bit.
---
 src/lib/eo/eo_private.h | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/lib/eo/eo_private.h b/src/lib/eo/eo_private.h
index 579ac6d..135966d 100644
--- a/src/lib/eo/eo_private.h
+++ b/src/lib/eo/eo_private.h
@@ -277,8 +277,14 @@ static inline void
 _eo_unref(_Eo_Object *obj)
 {
    --(obj->refcount);
-   if (obj->refcount == 0)
+   if (EINA_UNLIKELY(obj->refcount <= 0))
      {
+        if (obj->refcount < 0)
+          {
+             ERR("Obj:%p. Refcount (%d) < 0. Too many unrefs.", obj, 
obj->refcount);
+             return;
+          }
+
         if (obj->destructed)
           {
              ERR("Object %p already destructed.", _eo_id_get(obj));
@@ -320,11 +326,6 @@ _eo_unref(_Eo_Object *obj)
         else
           _eo_ref(obj); /* If we manual free, we keep a phantom ref. */
      }
-   else if (obj->refcount < 0)
-     {
-        ERR("Obj:%p. Refcount (%d) < 0. Too many unrefs.", obj, obj->refcount);
-        return;
-     }
 }
 
 #endif

-- 


Reply via email to