poppler/Gfx.cc |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 09000ce81397eba1eed383f730e48b92b932e0b4
Author: Albert Astals Cid <[email protected]>
Date:   Thu May 4 18:35:16 2017 +0200

    Minor optimization
    
    Do not create a timer for every single operation since we hardly run the
    profileCommands if branch

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index a8f5be95..6f06f6ca 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Jonathan Blandford <[email protected]>
-// Copyright (C) 2005-2013, 2015, 2016 Albert Astals Cid <[email protected]>
+// Copyright (C) 2005-2013, 2015-2017 Albert Astals Cid <[email protected]>
 // Copyright (C) 2006 Thorkild Stray <[email protected]>
 // Copyright (C) 2006 Kristian Høgsberg <[email protected]>
 // Copyright (C) 2006-2011 Carlos Garcia Campos <[email protected]>
@@ -757,13 +757,17 @@ void Gfx::go(GBool topLevel) {
        printf("\n");
        fflush(stdout);
       }
-      GooTimer timer;
+      GooTimer *timer = nullptr;
+
+      if (unlikely(profileCommands)) {
+          timer = new GooTimer();
+      }
 
       // Run the operation
       execOp(&obj, args, numArgs);
 
       // Update the profile information
-      if (profileCommands) {
+      if (unlikely(profileCommands)) {
        GooHash *hash;
 
        hash = out->getProfileHash ();
@@ -778,8 +782,9 @@ void Gfx::go(GBool topLevel) {
            hash->add (cmd_g, data_p);
          }
          
-         data_p->addElement(timer.getElapsed ());
+         data_p->addElement(timer->getElapsed ());
        }
+       delete timer;
       }
       obj.free();
       for (i = 0; i < numArgs; ++i)
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to