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

Faster COSNumber

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 2.0.20, 3.0.0 PDFBox
    • 2.0.21, 3.0.0 PDFBox
    • None

    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

            tilman Tilman Hausherr
            Faltiska Alfred
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: