Uploaded image for project: 'REEF (Retired)'
  1. REEF (Retired)
  2. REEF-812

Improve NetworkServiceTest

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 0.13
    • 0.14
    • REEF-IO
    • None

    Description

      During REEF-807, NetworkServiceTest was revealed as the most memory consuming testsuite. Although this is just a test code, it would be better if we improve inefficient code like the following.

      -            // build the message
      -            final StringBuilder msb = new StringBuilder();
      -            for (int i = 0; i < size; i++) {
      -              msb.append("1");
      -            }
      -            final String message = msb.toString();
      -
      +            final String message = StringUtils.repeat('1', size);
      

      Also, it would be better execute `open()` once per each connection.

      +  conn.open();
      for (int i = 0; i < numMessages; i++) {
        ...
      -  conn.open();
      -  conn.write(sb.toString());
      +  conn.write(message);
      }
      

      Attachments

        Issue Links

          Activity

            People

              dongjoon Dongjoon Hyun
              dongjoon Dongjoon Hyun
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: