Uploaded image for project: 'OpenWebBeans'
  1. OpenWebBeans
  2. OWB-639

[perf] InjectionResolver.getBeanCacheKey creates many StringBuilder instances

Bulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersConvert to sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment Visibility
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.1.4
    • 1.1.4
    • Core
    • None
    • 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?

      Attachments

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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            struberg Mark Struberg
            markoc50 Martin Kočí
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment