Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-1101

Improve mapping performance caused by overuse of Optional and Stream

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Critical
    • Resolution: Complete
    • Affects Version/s: 2.0 M4 (Kay)
    • Fix Version/s: 2.0 RC1 (Kay)
    • Component/s: Mapping / Conversion
    • Labels:
      None
    • Sprint:
      Kay RC1

      Description

      Since Kay 2.0 M2 we experience a heavy negative performance impact during mapping-based object conversion. This is caused by heavy usage of Optional and Stream APIs without caching of the resulting values. PropertyValueProvider requires Optional wrapping for each get and set operation. Following the Optional programming model creates a huge amount of instances which reflect in direct increased CPU usage and CPU usage (timing jitter) because of a high GC pressure.

      Java 8 Stream API usage in hot code paths allocates object instances during streaming. Non-cached results cause Stream object allocation which also reflect in decreased performance.

      We should remove Optional from the main paths and keep it only if cached and use it along optional.orElse(null). Optional is well-suited for presence and absence caching. We also should introduce caches in front of Stream usage to retain improved code readability but not pay the cost of Stream instances on each invocation.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              cstrobl Christoph Strobl
              Reporter:
              mp911de Mark Paluch
              Last updater:
              Oliver Drotbohm
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: