Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3721

[Java] Add cache to org.apache.avro.JsonProperties.getObjectProps

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.11.1
    • 1.12.0
    • java

    Description

      Currently every time you invoke JsonProperties.getObjectProps on same instance, the code loops over the props and creates a new LinkedHashMap and a new UnmodifiableMap.

       

      In our use case, we store a Protocol (and the JsonProperties) and access the same instances multiple times.

       

      Storing a simple cache "private Map<String, Object> objectProps;" inside JsonProperties will slightly improve performance and memory usage.

      objectProps can be lazy initialized in JsonProperties.getObjectProps and reset when "JsonProperties.addProp(String, JsonNode)" is invoked.

       

      Thanks.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              elishamoshe Moshe Elisha
              Votes:
              0 Vote for this issue
              Watchers:
              3 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 - 0.5h
                  0.5h