gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Bastiaan Jacques
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-2127-g2e5e573
Date: Tue, 10 Jun 2014 09:50:48 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  2e5e5737faca9936e6a8645e69b380dddc52bf61 (commit)
      from  9323a5502dad11f4c17ab3aa91fc2b0ea35b68c3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=2e5e5737faca9936e6a8645e69b380dddc52bf61


commit 2e5e5737faca9936e6a8645e69b380dddc52bf61
Author: Bastiaan Jacques <address@hidden>
Date:   Tue Jun 10 11:45:28 2014 +0200

    Switch the GcResource container type to forward_list.
    
    We don't make use of bidirectional access, so a singly linked list
    is adequate. The order of elements seems to be irrelevant, so
    it doesn't matter that we now push elements at the front rather
    than the back.
    
    This change reduces the needed memory for this container (that
    typically contains a few thousand pointers) by about two-thirds.
    cleanUnreachable() runs in slightly less time.

diff --git a/libbase/GC.cpp b/libbase/GC.cpp
index 1974bf1..e0ef530 100644
--- a/libbase/GC.cpp
+++ b/libbase/GC.cpp
@@ -73,8 +73,7 @@ GC::cleanUnreachable()
 
     size_t deleted = 0;
 
-    for (ResList::iterator i = _resList.begin(), e = _resList.end(); i != e;) {
-        const GcResource* res = *i;
+    _resList.remove_if([&deleted](const GcResource* res) {
         if (!res->isReachable()) {
 
 #if GNASH_GC_DEBUG > 1
@@ -82,13 +81,13 @@ GC::cleanUnreachable()
 #endif
             ++deleted;
             delete res;
-            i = _resList.erase(i); // _resListSize updated at end of loop
+            return true;
         }
         else {
             res->clearReachable();
-            ++i;
+            return false;
         }
-    }
+    });
 
     _resListSize -= deleted;
 
diff --git a/libbase/GC.h b/libbase/GC.h
index ee4a26a..183891b 100644
--- a/libbase/GC.h
+++ b/libbase/GC.h
@@ -29,7 +29,7 @@
 //   
 //#define GNASH_GC_DEBUG 1
 
-#include <list>
+#include <forward_list>
 #include <map>
 #include <string>
 #include <cassert>
@@ -198,7 +198,7 @@ public:
         assert(!item->isReachable());
 #endif
 
-        _resList.push_back(item); ++_resListSize;
+        _resList.emplace_front(item); ++_resListSize;
 
 #if GNASH_GC_DEBUG > 1
         log_debug(_("GC: collectable %p added, num collectables: %d"), item, 
@@ -265,7 +265,7 @@ public:
 private:
 
     /// List of collectables
-    typedef std::list<const GcResource*> ResList;
+    typedef std::forward_list<const GcResource*> ResList;
 
     /// Mark all reachable resources
     void markReachable() {

-----------------------------------------------------------------------

Summary of changes:
 libbase/GC.cpp |    9 ++++-----
 libbase/GC.h   |    6 +++---
 2 files changed, 7 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]