Nicholas Nethercote
28687bca75
Optimize CMap.prototype.forEach().
...
This change avoids the element stringification caused by for..in for the
vast majority of CMaps.
When loading the PDF from issue #4580 , this change reduces peak RSS from ~650
to ~600 MiB, and improves overall speed by ~20%, from 902 ms to 713 ms. Other
CMap-heavy documents will also see improvements.
2014-07-30 06:28:47 -07:00
Nicholas Nethercote
b86daed29d
Make CMap.map quasi-private.
...
This makes it easier for the representation to be improved.
2014-07-30 06:26:35 -07:00
Yury Delendik
7026543663
Merge pull request #5059 from timvandermeij/unused-code
...
Removing unused code and enforcing additional JSHint options
2014-07-29 15:04:43 -05:00
Jonas Jenwald
2264748109
Merge pull request #5096 from nnethercote/bidi-length
...
Right-size |chars.length| and |type.length| in bidi().
2014-07-29 12:19:22 +02:00
Nicholas Nethercote
f1d5ec407e
Right-size |chars.length| and |type.length| in bidi().
...
This lets the JS engine resize the array elements buffer immediately,
thus avoiding some intermediate resizings. This can save multiple MiBs
of reallocation in text-heavy files.
2014-07-28 16:35:45 -07:00
Yury Delendik
6038ee7cff
Merge pull request #5063 from Snuffleupagus/ps-parser-avoid-intermediate-string-creation
...
Avoid creating intermediate strings in the PostScriptLexer
2014-07-28 15:07:32 -05:00
Jonas Jenwald
4960af3a4c
Avoid creating intermediate strings in the PostScriptLexer
2014-07-27 13:51:28 +02:00
Jonas Jenwald
a5c98aab36
Re-factor parsing of the Linearization dictionary
2014-07-27 12:56:09 +02:00
Jonas Jenwald
86f9503876
Remove src/core/cidmaps.js
2014-07-25 21:53:17 +02:00
Jonas Jenwald
c3c72948b9
Stop including cidmaps.js
...
In b5b94a4af3
, i.e. PR #4259 , we stopped using cidmaps.js. Despite that, it's still included when PDF.js is built. At almost 0.5 MB (and approx. 7000 lines), this is currently the single largest file in the codebase.
Including such a large file in the builds, when it is not actually used, seems extremely wasteful; hence this patch.
2014-07-25 21:53:09 +02:00
Yury Delendik
1e21bac9d3
Merge pull request #5077 from Snuffleupagus/issue-5039
...
Fix loading of PDF files with invalid or missing Type3 characters (issue 5039)
2014-07-25 14:34:51 -05:00
Tim van der Meij
62e6265fb3
Merge pull request #5074 from nnethercote/readPostScriptTable-join
...
Use Array.join to build up strings in readPostScriptTable().
2014-07-25 21:26:54 +02:00
Yury Delendik
5d4eebc6a7
Merge pull request #5034 from pramodhkp/fixupgstate2
...
[SVG] Adds clip operator, fixes setGState, fill, stroke operators
2014-07-25 13:52:29 -05:00
pramodhkp
6e4dd83a4d
Added endPath, endText. fixes extra <g> elements
2014-07-25 23:30:29 +05:30
pramodhkp
2380b38b27
Fixed setGState, viewport transform
2014-07-25 23:21:23 +05:30
pramodhkp
a55c9856e9
Misc variable initialization
2014-07-25 23:21:23 +05:30
pramodhkp
0688fd3d70
Added fill, stroke, line-join & font attr
2014-07-25 23:20:55 +05:30
pramodhkp
03f1de3403
Added clip operator
2014-07-25 23:13:52 +05:30
Yury Delendik
2aea7d7047
Merge pull request #5078 from nnethercote/Ref-toString
...
Optimize Ref_toString().
2014-07-25 10:10:10 -05:00
Nicholas Nethercote
1039791472
Use Array.join to build up strings in readPostScriptTable().
...
This avoids about 5 MiB of string allocations on one test case.
2014-07-24 16:12:08 -07:00
Tim van der Meij
41faa78368
Fixes typo in promises implementation for legacy browsers
2014-07-24 17:11:22 +02:00
Nicholas Nethercote
856e1c600b
Optimize Ref_toString().
...
I have a large PDF where this function is called 1.6 million times
during loading. Minimizing the string concatenations reduces the
cumulative allocations done by Firefox within this function from 113 MB
to 48 MB.
2014-07-24 06:49:56 -07:00
Jonas Jenwald
2485f11829
Fix loading of PDF files with invalid or missing Type3 characters (issue 5039)
2014-07-24 15:03:22 +02:00
Nicholas Nethercote
501446ccc4
Optimize common cases in hexToStr().
...
This avoids the creation of over two million array objects when viewing
http://www.dynacw.co.jp/Portals/3/fontsamplepdf/sample_4942546800828.pdf ,
and reduces load time from 76 to 73 ms.
2014-07-22 23:26:03 -07:00
Nicholas Nethercote
c7f02d2c8e
Minimize memory usage of font-related arrays.
...
This patch replaces some vanilla arrays with typed arrays, and avoids
some array copying.
It reduces the peak RSS when viewing
http://www.dynacw.co.jp/Portals/3/fontsamplepdf/sample_4942546800828.pdf
from ~940 MiB to ~750 MiB, and reduces its load time from 83 to 76 ms.
2014-07-22 22:47:45 -07:00
Jonas Jenwald
f13c217b25
Fix another seac regression (issue 4801)
2014-07-22 21:44:13 +02:00
Jonas Jenwald
b950118681
Revert commit fc73e2e
(PR 5005) for breaking certain PDF files
2014-07-22 21:17:57 +02:00
Yury Delendik
53320ce734
Merge pull request #5012 from Snuffleupagus/issue-5010
...
Prevent CMapFactory.create from failing by passing the necessary parameters from PartialEvaluator_readToUnicode (issue 5010)
2014-07-22 10:54:35 -05:00
Yury Delendik
584fef90ab
Merge pull request #5037 from Snuffleupagus/issue-5036
...
Add |fillRgb| method to LabCS
2014-07-21 09:55:55 -05:00
Tim van der Meij
7586d777eb
Enforcing JSHint's undef option
2014-07-19 16:41:07 +02:00
Tim van der Meij
34728ee49b
Removing unused code
2014-07-18 22:34:50 +02:00
Tim van der Meij
4be90c35f8
Merge pull request #5021 from CodingFabian/issue-5020
...
Fixes mesh fill pattern with optional matrix
2014-07-18 20:51:44 +02:00
Jonas Jenwald
9c6316fc15
Merge pull request #5005 from fkaelberer/faster_ChunkedStream_getByte
...
Faster chunkedStream_getByte()
2014-07-18 18:23:49 +02:00
Tim van der Meij
a7800c276b
Merge pull request #5015 from Snuffleupagus/zero-WebGL-canvases
...
Zero the height and width of the WebGL canvases on cleanup
2014-07-16 17:07:18 +02:00
Tim van der Meij
e97efaa70a
Merge pull request #5033 from nnethercote/makeCssRgb
...
Avoid creating intermediate strings in Util.makeCssRgb().
2014-07-16 16:10:29 +02:00
Fabian Lange
dd2adf6200
Fixes mesh fill pattern with optional matrix ( #5020 )
...
In the referenced issue, there is a PDF which uses a fill pattern which does not
have a matrix defined. This causes singularValueDecompose2dScale to fail with
undefined property error when accessing elements of that matrix.
This fix will only use the matrix when it is defined. The output for the PDF in
question now looks identical to chrome and preview with respect to the gradient
fill pattern.
2014-07-13 15:45:12 +02:00
Jonas Jenwald
0237d5036a
Merge pull request #5025 from nnethercote/share-zero-length-buffers
...
Improve how DecodeStream handles empty buffers.
2014-07-13 12:13:06 +02:00
Yury Delendik
b5e5de00df
Merge pull request #5017 from Snuffleupagus/bug-1028735
...
[CIDFontType2] Map characters missing in toUnicode to the private use area (bug 1028735 and issue 4881)
2014-07-12 07:18:07 -05:00
Jonas Jenwald
1cb4de2227
Add |fillRgb| method to LabCS
2014-07-10 12:06:19 +02:00
Nicholas Nethercote
31c613f064
Avoid creating intermediate strings in Util.makeCssRgb().
...
On one example (the Wuppertal map) this avoids the creation of over
230,000 intermediate strings.
2014-07-08 21:49:19 -07:00
pramodhkp
afd853e962
Added units for lengths
2014-07-08 23:03:17 +05:30
Jonas Jenwald
a7c786775d
[CIDFontType2] Map characters missing in toUnicode to the private use area (bug 1028735 and issue 4881)
2014-07-05 00:18:51 +02:00
pramodhkp
86e584d767
Memory optimzation for constructPath
2014-07-04 20:43:40 +05:30
Nicholas Nethercote
a483c80fc3
Make QueueOptimizer easier to read.
...
QueueOptimizer is really hard to read. Enough so that it's blocking my
efforts to streamline the representation used for operator lists.
This patch improves its readability in the following ways.
- More descriptive variable names make the sequence checking much clearer,
as do additional comments.
- The addState() functions now return the index of the first op past the
sequence, instead of setting context.currentOperation to the last op of
the sequence.
- The loop in optimize() is clearer.
- The array modification in the fourth addState() function is much clearer
-- we're just removing trios of ops.
- All four |addState| functions are now more consistent with each other.
I used some debug printfs to find documents where these optimizations are
used and then checked that the number of optimized ops was the same before
and after my changes.
2014-07-03 19:16:31 -07:00
Nicholas Nethercote
db866945b7
Improve how DecodeStream handles empty buffers.
...
DecodeStream currently initializes its |buffer| field to |null|, which
is reasonable, because lots of DecodeStreams never need to instantiate a
buffer. But this requires various special cases in the code.
This patch change it so DecodeStreamClosure has a single empty
Uint8Array which gets shared between all buffers upon initialization.
This avoids the special cases.
DecodeStream.prototype.ensureBuffer() is really hot, and this removes a
test from the fast path. For one 226 page scanned document this sped up
rendering by about 2%.
2014-07-02 18:53:21 -07:00
fkaelberer
fc73e2e173
use getBytes() instead of looping over getByte()
2014-06-27 09:09:54 +02:00
Jonas Jenwald
c5f4051a75
A few small optimizations of adjustMapping
...
Replace a couple of |in| checks with comparisons against undefined.
2014-06-27 00:59:42 +02:00
Jonas Jenwald
c121def806
A few small optimizations for CIDFontType2 fonts
...
Cache a constant length and replace one usage of |in| with a comparison against undefined.
2014-06-27 00:52:54 +02:00
Jonas Jenwald
04975acceb
Prevent CMapFactory.create from failing by passing the necessary parameters from PartialEvaluator_readToUnicode (issue 5010)
2014-06-27 00:46:16 +02:00
fkaelberer
9a41659ae7
Faster chunkedStream_getByte()
2014-06-26 22:34:00 +02:00
pramodhkp
7efd50e64d
Added paintJpegXObject
2014-06-25 03:55:14 +05:30
pramodhkp
d799a18b74
Added paintSolidColorImageMask
2014-06-25 02:48:11 +05:30
pramodhkp
c8a4ab3a19
Optimization of save/restore usage
2014-06-25 02:47:29 +05:30
Yury Delendik
6d5a04149b
Merge pull request #4993 from pramodhkp/rectelmnt
...
Combine re element into constructPath
2014-06-24 09:27:21 -05:00
pramodhkp
8407d28c9e
Combine re element into constructPath
2014-06-25 00:27:42 +05:30
Jonas Jenwald
8ad1ea3c5f
Zero the height and width of the WebGL canvases on cleanup
2014-06-24 13:52:22 +02:00
Yury Delendik
10db93be29
Merge pull request #4980 from Snuffleupagus/bug-1027533
...
Additional heuristics to recognize unknown glyphs for toUnicode (bug 1027533)
2014-06-23 21:56:13 -05:00
Yury Delendik
bb7e7d33c5
Merge pull request #4976 from CodingFabian/restructure-evaluator-read
...
Restructured EvaluatorPreprocessor_read to be more natural.
2014-06-23 21:50:14 -05:00
Yury Delendik
c28839b2f3
Merge pull request #4944 from Snuffleupagus/issue-4934
...
Don't blindly trust toUnicode when building toFontChar for non-standard fonts without a font file (issue 4934)
2014-06-23 21:49:24 -05:00
Fabian Lange
60f67c3961
Restructured EvaluatorPreprocessor_read to be more natural.
2014-06-23 23:35:25 +02:00
Yury Delendik
3ad58db7e8
Merge pull request #4982 from nnethercote/use-null-for-zero-args
...
Use null instead of [] for ops with no args.
2014-06-23 15:38:48 -05:00
Nicholas Nethercote
081866a184
Use null instead of [] for ops with no args.
...
This reduces peak RSS on one test file from ~600 to ~560 MiB.
2014-06-22 16:03:48 -07:00
Jonas Jenwald
b19bb74813
Additional heuristics to recognize unknown glyphs for toUnicode (bug 1027533)
2014-06-20 09:57:16 +02:00
Yury Delendik
834f466c05
Fixes SVG transforms on restore
2014-06-19 23:18:04 -05:00
Yury Delendik
6258ae61d5
Merge pull request #4979 from pramodhkp/svg-v3
...
SVG Viewer Example demo
2014-06-19 21:16:21 -05:00
pramodhkp
dd253aadeb
SVG Viewer example demo
2014-06-20 08:25:05 +05:30
Yury Delendik
84157e039d
Merge pull request #4973 from nnethercote/better-ref-keys
...
Factor out repeated Ref key string generation code.
2014-06-19 21:00:09 -05:00
Nicholas Nethercote
1ad3ffbc7b
Factor out repeated Ref key string generation code.
...
In src/core/obj.js, we convert a Ref to a string to index into a table like
this: 'R1.0'. This conversion is repeated numerous times.
This patch factors out the conversion into a new function.
Ref.prototype.toString().
2014-06-19 18:22:39 -07:00
Yury Delendik
c0a6b0f308
Merge pull request #4971 from yurydelendik/rm-suppressEncryption
...
Removes error catch from fetchUncompressed()
2014-06-18 22:03:09 -05:00
Yury Delendik
b557b87fc9
Merge pull request #4972 from nnethercote/preprocessor-read
...
Avoid allocating return object in EvaluatorPreprocessor_read().
2014-06-18 22:00:31 -05:00
Nicholas Nethercote
17170af3c7
Avoid allocating return object in EvaluatorPreprocessor_read().
...
This function can be called 100s of 1000s or even millions of times, and the
allocated return object accounts for 10% of all GC thing allocations for some
documents. It's easy to avoid, which reduces stress on the garbage collector,
and this patch does that.
2014-06-18 16:41:29 -07:00
Yury Delendik
623fa29300
Removes error catch from fetchUncompressed()
2014-06-18 18:30:27 -05:00
Yury Delendik
fbdab2c7c5
Not ignoring MissingDataException exception.
2014-06-18 18:24:54 -05:00
Yury Delendik
cf4bc42e33
Merge pull request #4968 from nnethercote/glyphBuf
...
Build up textChunk.str more efficiently.
2014-06-18 17:51:07 -05:00
Jonas Jenwald
7a83291c14
Merge pull request #4970 from yurydelendik/AnnotationUtils
...
Fixes AnnotationUtils in the extension build
2014-06-19 00:44:42 +02:00
Yury Delendik
88fd1aa78b
Removes PDFJS.Annotation
2014-06-18 16:58:11 -05:00
Yury Delendik
c1c950ce74
Fixes AnnotationUtils in the extension build
2014-06-18 16:42:08 -05:00
Tim van der Meij
4c759527d1
Implements onerror for JpegStreams
2014-06-18 23:02:52 +02:00
Jonas Jenwald
2282c98500
Merge pull request #4965 from yurydelendik/annotations
...
Splits shared/annotation.js into core/ and display/
2014-06-18 17:01:38 +02:00
Nicholas Nethercote
bce7601480
Build up textChunk.str more efficiently.
...
PartialEvaluator.getTextContent() builds up textChunk strings 1 char at a time,
creating many 100s of 1000s of intermediate strings along the way. This patch
make it instead push chars to an array and then join them at the end, as we
have done in numerous other places.
2014-06-18 07:48:22 -07:00
Nicholas Nethercote
4428cebdbc
Add ChunkedStream.ensureByte().
...
This new function is much faster than ensureRange(pos, pos+1), which is a very
common case.
This speeds up the rendering of some test cases (including the Tracemonkey
paper) by 4--5%.
2014-06-17 21:33:48 -07:00
Yury Delendik
bdeca30fbf
Splits shared/annotation.js into core/ and display/
2014-06-17 17:43:33 -05:00
Yury Delendik
0f0f0688a1
Merge pull request #4946 from Snuffleupagus/issue-3862
...
Refactor fake worker loading (issue 3862)
2014-06-17 13:27:01 -05:00
Yury Delendik
ea16723448
Merge pull request #4951 from pramodhkp/getoperatorlist
...
Added getOperatorList to api.js
2014-06-17 09:39:09 -05:00
pramodhkp
1d00e9d13c
Added getOperatorList to api.js
2014-06-18 01:30:42 +05:30
Yury Delendik
bad24bf707
Merge pull request #4950 from fkaelberer/fasterJPEGtransform
...
Faster JPEG transform
2014-06-17 09:03:23 -05:00
Yury Delendik
11302f09a4
Merge pull request #4959 from nnethercote/zero-cache-canvases
...
Zero the height and width of cached canvases before deleting them.
2014-06-17 08:26:04 -05:00
Yury Delendik
5a2e511cbd
Merge pull request #4955 from timvandermeij/rename-concatenate
...
Renames concatenateToArray to appendToArray
2014-06-17 08:21:47 -05:00
Jonas Jenwald
ab67e1c272
Let Parser_makeFilter return NullStream when an invalid stream is encountered (issue 3417)
2014-06-17 12:03:34 +02:00
fkaelberer
f9cde5d93e
faster JPEG transform
2014-06-17 10:09:17 +02:00
Nicholas Nethercote
7ef7f95374
Zero the height and width of the Cached canvases before deleting.
...
This reduces peak RSS by about 300 MiB on my Mac when scrolling slowly through
the first 30 pages of a scanned black and white document.
2014-06-16 22:58:11 -07:00
Jonas Jenwald
22cfcbcf8a
Merge pull request #4952 from yurydelendik/telemetry
...
Collect More Telemetry Data
2014-06-17 00:36:58 +02:00
Yury Delendik
0cd28ebfa3
Telemetry for used stream and font types
2014-06-16 16:41:04 -05:00
Tim van der Meij
9c072a5d4b
Renames concatenateToArray to appendToArray
2014-06-16 22:10:10 +02:00
Jonas Jenwald
3c78c7b8bc
Refactor fake worker loading (issue 3862)
2014-06-15 15:52:05 +02:00
Jonas Jenwald
158790981c
Don't blindly trust toUnicode when building toFontChar for non-standard fonts without a font file (issue 4934)
2014-06-14 22:59:08 +02:00
Yury Delendik
9f51e46917
Refactoring error reporting in JPX
2014-06-13 18:22:42 -05:00
fkaelberer
894d9fe085
Fix #3591 / list unsupported options
2014-06-13 16:41:27 -05:00
Yury Delendik
dd165f2918
SHA512 optimizations
2014-06-13 15:12:50 -05:00
Daniel West
1fce2856c6
Added support for decrypting PDF 1.7/2.0 Algorithm 5 revision 5 and 6.
...
*Added AES128 Encryption
*Added AES258 Encryption/Decryption
*Added SHA256
*Added SHA512
*Added class to handle 8 byte integers and associated bit operations
*Added SHA384
*Added routines to handle new algorithm and perform PDF2.0 hashing.
2014-06-13 13:05:47 -05:00