[poppler] poppler/Gfx.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Thu May 4 16:36:12 UTC 2017


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

New commits:
commit 09000ce81397eba1eed383f730e48b92b932e0b4
Author: Albert Astals Cid <aacid at kde.org>
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 <jrb at redhat.com>
-// Copyright (C) 2005-2013, 2015, 2016 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2013, 2015-2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006 Thorkild Stray <thorkild at ifi.uio.no>
 // Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2006-2011 Carlos Garcia Campos <carlosgc at gnome.org>
@@ -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)


More information about the poppler mailing list