summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2017-05-04 18:35:16 +0200
committerAlbert Astals Cid <aacid@kde.org>2017-05-04 18:35:16 +0200
commit09000ce81397eba1eed383f730e48b92b932e0b4 (patch)
tree5a343b2217227e6e3cb125c617681014712aaf02
parentb21b041f7948680c03109f0c404400a9dbc4544c (diff)
Minor optimization
Do not create a timer for every single operation since we hardly run the profileCommands if branch
-rw-r--r--poppler/Gfx.cc13
1 files changed, 9 insertions, 4 deletions
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@redhat.com>
-// Copyright (C) 2005-2013, 2015, 2016 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2005-2013, 2015-2017 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2006 Thorkild Stray <thorkild@ifi.uio.no>
// Copyright (C) 2006 Kristian Høgsberg <krh@redhat.com>
// Copyright (C) 2006-2011 Carlos Garcia Campos <carlosgc@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)