Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4895

Faster COSNumber

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.0.20, 3.0.0 PDFBox
    • Fix Version/s: 2.0.21, 3.0.0 PDFBox
    • Component/s: None
    • Labels:

      Description

      A small improvement can be made to COSNumber when checking if it's float.

      Current version uses indexOf twice, to check for '.' or 'e'.
      We can do that in one scan.

       

      Each call will scan through the entire string.
      We only have to scan until we find the chars, and stop if found.

       

      I found while profiling the code that the method gets called a lot, so the improvement makes a a bit of a difference.

        Attachments

        1. Untitled.png
          24 kB
          Alfred
        2. PDFBOX-4895-b.patch
          3 kB
          Alfred
        3. PDFBOX-4895.patch
          2 kB
          Alfred
        4. PDFBOX-3703-966635-p12.pdf-1.png
          101 kB
          Alfred

          Activity

            People

            • Assignee:
              tilman Tilman Hausherr
              Reporter:
              Faltiska Alfred

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment