Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of layoutMultilineText #1203

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

seibar
Copy link

@seibar seibar commented Mar 29, 2022

What?

Addresses: #1202. Previously long strings (> 10k characters) took very long for this function to execute (> 30 seconds). With this fix, a 10k character string executes in less than 1 second.

Testing?

  • Added a unit test
  • Executed integration tests (and fixed an issue that test number 15 uncovered)
  • A lot of testing using the scratchpad.

New Dependencies?

None

Checklist

  • I read CONTRIBUTING.md.
  • I read MAINTAINERSHIP.md#pull-requests.
  • I added/updated unit tests for my changes.
  • I added/updated integration tests for my changes.
  • I ran the integration tests.
  • I tested my changes in Node, Deno, and the browser.
  • I viewed documents produced with my changes in Adobe Acrobat, Foxit Reader, Firefox, and Chrome.
  • I added/updated doc comments for any new/modified public APIs.
  • My changes work for both new and existing PDF files.
  • I ran the linter on my changes.

Copy link

@ahaganDEV ahaganDEV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this change out in my own fork of this library and it does indeed fix the performance issues with the function.

DkDavid pushed a commit to DkDavid/pdf-lib that referenced this pull request Jan 20, 2023
@ej-shafran
Copy link

This is great! layoutMultilineText was causing me massive problems and I eventually had to write a version of it on my own. Your version seems to work just as well, though.

@flogy
Copy link

flogy commented Jul 14, 2023

Works like a charm, would be awesome to get this merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants