You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@reef.apache.org by "Dongjoon Hyun (JIRA)" <ji...@apache.org> on 2015/10/07 14:36:26 UTC
[jira] [Created] (REEF-812) Improve NetworkServiceTest
Dongjoon Hyun created REEF-812:
----------------------------------
Summary: Improve NetworkServiceTest
Key: REEF-812
URL: https://issues.apache.org/jira/browse/REEF-812
Project: REEF
Issue Type: Improvement
Components: REEF-IO
Affects Versions: 0.13
Reporter: Dongjoon Hyun
Assignee: Dongjoon Hyun
Priority: Trivial
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.
{code}
- // 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);
{code}
Also, it would be better execute `open()` once per each connection.
{code}
+ conn.open();
for (int i = 0; i < numMessages; i++) {
...
- conn.open();
- conn.write(sb.toString());
+ conn.write(message);
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)