Derby
  1. Derby
  2. DERBY-5021

[patch] avoid map look ups in a loop by using entrySet

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 10.7.1.1
    • Fix Version/s: 10.8.1.2
    • Component/s: Network Server
    • Labels:
      None
    • Urgency:
      Low

      Description

      various places code walks a keyset iterator in a loop and each time thru the loop does a map lookup for the value based on the current key. Avoid the map look ups by just iterating with an entry set iterator.

        Activity

        Gavin made changes -
        Workflow jira [ 12545233 ] Default workflow, editable Closed status [ 12802708 ]
        Knut Anders Hatlen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Knut Anders Hatlen added a comment -

        [bulk update] Close all resolved issues that haven't been updated for more than one year.

        Show
        Knut Anders Hatlen added a comment - [bulk update] Close all resolved issues that haven't been updated for more than one year.
        Rick Hillegas made changes -
        Fix Version/s 10.8.1.2 [ 12316362 ]
        Fix Version/s 10.8.1.1 [ 12316356 ]
        Rick Hillegas made changes -
        Fix Version/s 10.8.1.1 [ 12316356 ]
        Fix Version/s 10.8.1.0 [ 12315561 ]
        Knut Anders Hatlen made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Issue & fix info [Patch Available]
        Assignee Dave Brosius [ dbrosius@apache.org ]
        Resolution Fixed [ 1 ]
        Hide
        Knut Anders Hatlen added a comment -

        After DERBY-5143 we don't need the changes in EmbedConnection40 and NetConnection40 that reintroduced the compiler warnings. I removed the changes in those two files from the patch and committed revision 1085409. Thanks, Dave!

        Show
        Knut Anders Hatlen added a comment - After DERBY-5143 we don't need the changes in EmbedConnection40 and NetConnection40 that reintroduced the compiler warnings. I removed the changes in those two files from the patch and committed revision 1085409. Thanks, Dave!
        Hide
        Knut Anders Hatlen added a comment -

        The changes look reasonable to me, although I don't think any of the changes are in particularly performance critical code. One little problem is that the changes in EmbedConnection40 and NetConnection40 remove code that's there to prevent a compiler warning (there must be an easier way to do it than how we do it now, though), so now the warning is back:

        $ ant -q
        [javac] Note: /code/derby/d5021/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java uses unchecked or unsafe operations.
        [javac] Note: Recompile with -Xlint:unchecked for details.
        [javac] /code/derby/d5021/java/client/org/apache/derby/client/net/NetConnection40.java:349: warning: [unchecked] unchecked conversion
        [javac] found : java.util.Map
        [javac] required: java.util.Map<? extends java.lang.String,? extends java.lang.Class<?>>
        [javac] Map<String, Class<?>> genericTypeMap = new HashMap<String, Class<?>>(typeMap);
        [javac] ^
        [javac] 1 warning

        BUILD SUCCESSFUL
        Total time: 21 seconds

        Show
        Knut Anders Hatlen added a comment - The changes look reasonable to me, although I don't think any of the changes are in particularly performance critical code. One little problem is that the changes in EmbedConnection40 and NetConnection40 remove code that's there to prevent a compiler warning (there must be an easier way to do it than how we do it now, though), so now the warning is back: $ ant -q [javac] Note: /code/derby/d5021/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java uses unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [javac] /code/derby/d5021/java/client/org/apache/derby/client/net/NetConnection40.java:349: warning: [unchecked] unchecked conversion [javac] found : java.util.Map [javac] required: java.util.Map<? extends java.lang.String,? extends java.lang.Class<?>> [javac] Map<String, Class<?>> genericTypeMap = new HashMap<String, Class<?>>(typeMap); [javac] ^ [javac] 1 warning BUILD SUCCESSFUL Total time: 21 seconds
        Dave Brosius made changes -
        Field Original Value New Value
        Attachment use_entryset_iterators.diff [ 12470841 ]
        Dave Brosius created issue -

          People

          • Assignee:
            Dave Brosius
            Reporter:
            Dave Brosius
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development