DevelopingMagic / pdfassembler

MIT License
183 stars 34 forks source link

Bad performance (resetObjectIds) #5

Closed stevebaldwin21 closed 6 years ago

stevebaldwin21 commented 6 years ago

The resetObjectIds seems to be a big bottleneck of this lib, it uses recursion to loop through all the nodes and keys to assign relevant ids for indirect objects.

Do you think it could be more performant through iteration rather than recursion?

On a example PDF I was testing, its called more than 35,000 times for a two page pdf (with 5-6 fonts) which seems like a alot. (albeit the js object is quite large).

Do you have any recommendations to help performance?

I really enjoy this library so good job and thanks!