OpenWebBeans
  1. OpenWebBeans
  2. OWB-639

[perf] InjectionResolver.getBeanCacheKey creates many StringBuilder instances

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1.4
    • Fix Version/s: 1.1.4
    • Component/s: Core
    • Labels:
      None
    • Environment:
      OWB trunk

      Description

      InjectionResolver.getBeanCacheKey(Type, String, Annotation...) creates:

      1) calls java.lang.reflect.Type.toString() -> java.lang.Class.toString() : -> first StringBuilder
      2) StringBuilder cacheKey = new StringBuilder() -> second StringBuilder
      3) java.lang.annotation.Annotation.toString() -> many annotation types (for example javax.enterprise.util.AnnotationLiteral.toString())) create toString() output with another StringBuilder() -> third StringBuilder

      Questions:
      toString() methods are normally non-semantics and produce a debug String output. OWB InjectionResolver.getBeanCacheKey uses them to create a key: but are toString() really suitable for this? What if two different annotations produce same toString output? Can be a.getClass().getName() used for 3) ?

      Can be a small class Key better (in terms of memory allocation and GC collection) in this situation?

      1. OWB-639.patch
        2 kB
        Martin Kočí

        Activity

        Mark Struberg made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Struberg made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Mark Struberg made changes -
        Assignee Martin Kočí [ markoc50 ] Mark Struberg [ struberg ]
        Fix Version/s 1.1.4 [ 12319171 ]
        Martin Kočí made changes -
        Assignee Gurkan Erdogdu [ gerdogdu ] Martin Kočí [ markoc50 ]
        Martin Kočí made changes -
        Field Original Value New Value
        Attachment OWB-639.patch [ 12509712 ]
        Martin Kočí created issue -

          People

          • Assignee:
            Mark Struberg
            Reporter:
            Martin Kočí
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development