Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Issue 2414423002: Traverse PDF page tree only once in CPDF_Document (Closed)

Created:
4 years, 2 months ago by npm
Modified:
4 years, 2 months ago
CC:
pdfium-reviews_googlegroups.com
Target Ref:
refs/heads/master
Project:
pdfium
Visibility:
Public.

Description

Traverse PDF page tree only once in CPDF_Document In our current implementation of CPDF_Document::GetPage, we traverse the PDF page tree until we find the index we are looking for. This is slow when we do calls GetPage(0), GetPage(1), ... since in this case the page tree will be traversed n times if there are n pages. This CL makes sure the page tree is only traversed once. Time to load the PDF from the bug below in chrome official build: Before this CL: 1 minute 40 seconds After this CL: 5 seconds BUG=chromium:638513 Committed: https://pdfium.googlesource.com/pdfium/+/7c29e27dae139a205755c1a29b7f3ac8b36ec0da

Patch Set 1 #

Total comments: 6

Patch Set 2 : Traverse until needed #

Patch Set 3 : Nits #

Total comments: 7

Patch Set 4 : Move methods from namespace to private #

Unified diffs Side-by-side diffs Delta from patch set Stats (+147 lines, -115 lines) Patch
M core/fpdfapi/parser/cpdf_document.h View 1 2 3 3 chunks +12 lines, -5 lines 0 comments Download
M core/fpdfapi/parser/cpdf_document.cpp View 1 2 3 7 chunks +135 lines, -110 lines 0 comments Download

Messages

Total messages: 28 (17 generated)
npm
PTAL. I think corpus tests will pass after https://codereview.chromium.org/2419793004/ So please ignore red bots for ...
4 years, 2 months ago (2016-10-14 18:21:28 UTC) #6
Tom Sepez
https://codereview.chromium.org/2414423002/diff/1/core/fpdfapi/parser/cpdf_document.cpp File core/fpdfapi/parser/cpdf_document.cpp (right): https://codereview.chromium.org/2414423002/diff/1/core/fpdfapi/parser/cpdf_document.cpp#newcode507 core/fpdfapi/parser/cpdf_document.cpp:507: int nPages = pKid->GetIntegerFor("Count"); I think we have to ...
4 years, 2 months ago (2016-10-14 19:01:16 UTC) #7
npm
https://codereview.chromium.org/2414423002/diff/1/core/fpdfapi/parser/cpdf_document.cpp File core/fpdfapi/parser/cpdf_document.cpp (right): https://codereview.chromium.org/2414423002/diff/1/core/fpdfapi/parser/cpdf_document.cpp#newcode507 core/fpdfapi/parser/cpdf_document.cpp:507: int nPages = pKid->GetIntegerFor("Count"); On 2016/10/14 19:01:16, Tom Sepez ...
4 years, 2 months ago (2016-10-14 19:31:25 UTC) #8
dsinclair
https://codereview.chromium.org/2414423002/diff/1/core/fpdfapi/parser/cpdf_document.cpp File core/fpdfapi/parser/cpdf_document.cpp (right): https://codereview.chromium.org/2414423002/diff/1/core/fpdfapi/parser/cpdf_document.cpp#newcode507 core/fpdfapi/parser/cpdf_document.cpp:507: int nPages = pKid->GetIntegerFor("Count"); On 2016/10/14 19:31:25, npm wrote: ...
4 years, 2 months ago (2016-10-17 13:26:37 UTC) #9
npm
PTAL https://codereview.chromium.org/2414423002/diff/1/core/fpdfapi/parser/cpdf_document.cpp File core/fpdfapi/parser/cpdf_document.cpp (right): https://codereview.chromium.org/2414423002/diff/1/core/fpdfapi/parser/cpdf_document.cpp#newcode507 core/fpdfapi/parser/cpdf_document.cpp:507: int nPages = pKid->GetIntegerFor("Count"); On 2016/10/17 13:26:37, dsinclair ...
4 years, 2 months ago (2016-10-17 21:10:23 UTC) #14
dsinclair
Can you update the description with some numbers on the performance gain? https://codereview.chromium.org/2414423002/diff/40001/core/fpdfapi/parser/cpdf_document.cpp File core/fpdfapi/parser/cpdf_document.cpp ...
4 years, 2 months ago (2016-10-18 13:36:00 UTC) #15
npm
Updated with performance https://codereview.chromium.org/2414423002/diff/40001/core/fpdfapi/parser/cpdf_document.cpp File core/fpdfapi/parser/cpdf_document.cpp (right): https://codereview.chromium.org/2414423002/diff/40001/core/fpdfapi/parser/cpdf_document.cpp#newcode491 core/fpdfapi/parser/cpdf_document.cpp:491: if (nPagesToGo != 1) On 2016/10/18 ...
4 years, 2 months ago (2016-10-18 14:26:31 UTC) #17
dsinclair
lgtm
4 years, 2 months ago (2016-10-18 17:01:18 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2414423002/60001
4 years, 2 months ago (2016-10-18 17:01:28 UTC) #25
commit-bot: I haz the power
Committed patchset #4 (id:60001) as https://pdfium.googlesource.com/pdfium/+/7c29e27dae139a205755c1a29b7f3ac8b36ec0da
4 years, 2 months ago (2016-10-18 17:38:24 UTC) #27
dsinclair
4 years, 2 months ago (2016-10-20 17:23:32 UTC) #28
Message was sent while issue was closed.
A revert of this CL (patchset #4 id:60001) has been created in
https://codereview.chromium.org/2430313006/ by dsinclair@chromium.org.

The reason for reverting is: Possible cause of crbug.com/657897 reverting to
find out.

BUG=657897.

Powered by Google App Engine
This is Rietveld 408576698