Skip to content

Commit

Permalink
Replaced Integer.toString() by NumbersCache.get() where applicable
Browse files Browse the repository at this point in the history
 - in places which get called frequently
  • Loading branch information
chrjohn committed Jul 4, 2024
1 parent 53efb6d commit 2b8aea5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion quickfixj-base/src/main/java/quickfix/FieldMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ protected void setGroupCount(int countTag, int groupSize) {
} else {
count = getField(countTag);
}
count.setValue(Integer.toString(groupSize));
count.setValue(NumbersCache.get(groupSize));
} catch (final FieldNotFound e) {
// Shouldn't happen
throw new RuntimeError(e);
Expand Down
4 changes: 2 additions & 2 deletions quickfixj-base/src/main/java/quickfix/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ private void toXMLFields(Element message, String section, FieldMap fieldMap,
fieldElement.setAttribute("enum", enumValue);
}
}
fieldElement.setAttribute("tag", Integer.toString(field.getTag()));
fieldElement.setAttribute("tag", NumbersCache.get(field.getTag()));
final CDATASection value = document.createCDATASection(field.getObject().toString());
fieldElement.appendChild(value);
fields.appendChild(fieldElement);
Expand All @@ -424,7 +424,7 @@ private void toXMLFields(Element message, String section, FieldMap fieldMap,
groupsElement.setAttribute("name", name);
}
}
groupsElement.setAttribute("tag", Integer.toString(groupKey));
groupsElement.setAttribute("tag", NumbersCache.get(groupKey));
final List<Group> groups = fieldMap.getGroups(groupKey);
for (Group group : groups) {
toXMLFields(groupsElement, "group", group, dataDictionary);
Expand Down
2 changes: 1 addition & 1 deletion quickfixj-base/src/main/java/quickfix/MessageUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static Message getMinimalMessage(String messageString) {

public static String getStringField(String messageString, int tag) {
String value = null;
final String tagString = Integer.toString(tag);
final String tagString = NumbersCache.get(tag);
int start = messageString.indexOf(tagString, 0);
while (start != -1 && value == null) {
if ((start == 0 || messageString.charAt(start - 1) == FIELD_SEPARATOR)) {
Expand Down

0 comments on commit 2b8aea5

Please sign in to comment.