Skip to content

Commit

Permalink
Merge pull request #856 from dhoard/text-write-performance-change
Browse files Browse the repository at this point in the history
Changed to remove use of inefficient String method
  • Loading branch information
dhoard authored Aug 5, 2023
2 parents 98967b8 + 27fe3b7 commit a76a65d
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ public static void write004(Writer writer, Enumeration<Collector.MetricFamilySam
}

private static void writeEscapedHelp(Writer writer, String s) throws IOException {
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
char[] characters = s.toCharArray();
for (int i = 0; i < characters.length; i++) {
char c = characters[i];
switch (c) {
case '\\':
writer.append("\\\\");
Expand All @@ -153,8 +154,9 @@ private static void writeEscapedHelp(Writer writer, String s) throws IOException
}

private static void writeEscapedLabelValue(Writer writer, String s) throws IOException {
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
char[] characters = s.toCharArray();
for (int i = 0; i < characters.length; i++) {
char c = characters[i];
switch (c) {
case '\\':
writer.append("\\\\");
Expand Down

0 comments on commit a76a65d

Please sign in to comment.