ICEpdf
  1. ICEpdf
  2. PDF-50

Performance Improvement for OFont character advance calculation

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      any

      Description

      When profiling for PDF-13, several red flags came up around how we where calculating the character advance metrics for layout in the OFont classes.

      The first big offender was GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts() was being called for every new instance of a ofont/Font object. This system call is pretty expensive.

      The next big offender was in related to a sequence of awt calls to get a glphys x and y advance values. I change the code to cache the metric information and only do the full calculation when we need to.

      Two very simple optimizations that increased the parsing speed significantly for the OS release.

        Activity

        Hide
        Patrick Corless added a comment -

        ICEpdf 3.1.0 has been released, closing issues.

        Show
        Patrick Corless added a comment - ICEpdf 3.1.0 has been released, closing issues.
        Hide
        Patrick Corless added a comment -

        There were a few regression in the the image comparor that showed incorrect glyph width calculations for layout. I had logic error when calculating a font point size change which failed to clear the echarAdvanceCache map. Silly mistake.

        Show
        Patrick Corless added a comment - There were a few regression in the the image comparor that showed incorrect glyph width calculations for layout. I had logic error when calculating a font point size change which failed to clear the echarAdvanceCache map. Silly mistake.
        Hide
        Patrick Corless added a comment -

        Qa found a regression with font width which is related to this bug.

        Show
        Patrick Corless added a comment - Qa found a regression with font width which is related to this bug.
        Hide
        Patrick Corless added a comment -

        It turns out the the deriveFont() call where being used for different font instances and as a resulted the cached widths weren't always correct. Update code slightly to recalculate width on the fly but still skip the heavy system calls. I aslo added code to clear the cache when deriveFont is called with metrics changing data.

        Show
        Patrick Corless added a comment - It turns out the the deriveFont() call where being used for different font instances and as a resulted the cached widths weren't always correct. Update code slightly to recalculate width on the fly but still skip the heavy system calls. I aslo added code to clear the cache when deriveFont is called with metrics changing data.
        Hide
        Patrick Corless added a comment -

        Found an issue in where the glyph width was incorrectly being calculated after the optimization.

        Show
        Patrick Corless added a comment - Found an issue in where the glyph width was incorrectly being calculated after the optimization.
        Hide
        Patrick Corless added a comment -

        Checked in source, closing.

        Show
        Patrick Corless added a comment - Checked in source, closing.

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Patrick Corless
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: