From 2eb7c7dd6392488d858989da8d57d618f58f04ca Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 18 Aug 2016 09:58:19 -0700 Subject: 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 --- fpdfsdk/javascript/app.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fpdfsdk/javascript/app.h') 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 #include #include @@ -165,7 +166,7 @@ class app : public CJS_EmbedObj { bool m_bCalculate; bool m_bRuntimeHighLight; - std::vector> m_Timers; + std::map> m_Timers; }; class CJS_App : public CJS_Object { -- cgit v1.2.3