diff options
author | dsinclair <dsinclair@chromium.org> | 2016-08-18 09:58:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-18 09:58:19 -0700 |
commit | 2eb7c7dd6392488d858989da8d57d618f58f04ca (patch) | |
tree | c1c1bee66b9faac09c4a9c2f28d708c064396f6b /fpdfsdk/javascript/app.h | |
parent | 9282819ce86f93ca46a73adb43b5c50289f4c99e (diff) | |
download | pdfium-2eb7c7dd6392488d858989da8d57d618f58f04ca.tar.xz |
Use a map for app::m_Timers
Currently the timers is a vector. When we cancel a timer we have an O(n) operation
to remove the timer. If there are a lot of timers (which this test has > 16k) this can
take a long time. The impact is a lot lower in Release, but the test is very slow in Debug.
From Linux on waterfall:
[ RUN ] FPDFFormFillEmbeddertest.BUG_634716
[ OK ] FPDFFormFillEmbeddertest.BUG_634716 (7855 ms)
From Linux try bot:
[ RUN ] FPDFFormFillEmbeddertest.BUG_634716
[ OK ] FPDFFormFillEmbeddertest.BUG_634716 (431 ms)
From Linux XFA Rel GYP on waterfall:
[ RUN ] FPDFFormFillEmbeddertest.BUG_634716
[ OK ] FPDFFormFillEmbeddertest.BUG_634716 (185 ms)
From Linux XFA Rel GYP try bot:
[ RUN ] FPDFFormFillEmbeddertest.BUG_634716
[ OK ] FPDFFormFillEmbeddertest.BUG_634716 (72 ms)
Review-Url: https://codereview.chromium.org/2251333002
Diffstat (limited to 'fpdfsdk/javascript/app.h')
-rw-r--r-- | fpdfsdk/javascript/app.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fpdfsdk/javascript/app.h b/fpdfsdk/javascript/app.h index 97db59e437..911d86586a 100644 --- a/fpdfsdk/javascript/app.h +++ b/fpdfsdk/javascript/app.h @@ -7,6 +7,7 @@ #ifndef FPDFSDK_JAVASCRIPT_APP_H_ #define FPDFSDK_JAVASCRIPT_APP_H_ +#include <map> #include <memory> #include <vector> @@ -165,7 +166,7 @@ class app : public CJS_EmbedObj { bool m_bCalculate; bool m_bRuntimeHighLight; - std::vector<std::unique_ptr<GlobalTimer>> m_Timers; + std::map<GlobalTimer*, std::unique_ptr<GlobalTimer>> m_Timers; }; class CJS_App : public CJS_Object { |