Uploaded image for project: 'ORC'
  1. ORC
  2. ORC-595

Optimize Decimal64 scale calculation

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.7.0
    • Component/s: encoding
    • Labels:
      None
    • Flags:
      Important

      Description

      Currently Decimal64 is using an inner loop to apply the correct scale to each read Long value https://github.com/apache/orc/blob/master/java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java#L1294

      A more efficient way would be to apply the scale using a single array access and by multiplying by 10 in the power of (scale - scratchScaleVector[r]).

      An extra optimization would be to keep all powers of 10 (up to 18) in a static array and reuse it across runtime instead of calculating each time.

      cc: Ramesh Kumar Thangarajan Gopal Vijayaraghavan

        Attachments

        1. Profile-ORC-595-patch.png
          74 kB
          Panagiotis Garefalakis
        2. Profile-ORC-595-clean.png
          97 kB
          Panagiotis Garefalakis
        3. DecimalBenchPerf-ORC-595.log
          76 kB
          Panagiotis Garefalakis
        4. DecimalBenchPerf-Clean.log
          52 kB
          Panagiotis Garefalakis
        5. DecimalBench-ORC-595-scale2.log
          5 kB
          Panagiotis Garefalakis
        6. DecimalBench-Clean-scale2.log
          5 kB
          Panagiotis Garefalakis

          Issue Links

            Activity

              People

              • Assignee:
                pgaref Panagiotis Garefalakis
                Reporter:
                pgaref Panagiotis Garefalakis
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m