Skip to content

Commit 6309891

Browse files
Henr1k80Mpdreamz
authored andcommitted
Avoid doing string concat when not needed
1 parent 13a8c4e commit 6309891

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Nest/Document/Multiple/Bulk/BulkRequestJsonConverter.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
2929
op.Routing = op.GetRoutingForOperation(settings.Inferrer);
3030

3131
var opJson = requestResponseSerializer.SerializeToString(op, SerializationFormatting.None);
32-
writer.WriteRaw($"{{\"{op.Operation}\":" + opJson + "}\n");
32+
writer.WriteRaw("{\"");
33+
writer.WriteRaw(op.Operation);
34+
writer.WriteRaw("\":");
35+
writer.WriteRaw(opJson);
36+
writer.WriteRaw("}\n");
3337
var body = op.GetBody();
3438
if (body == null) continue;
3539

@@ -40,7 +44,8 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
4044
)
4145
.SerializeToString(body, SerializationFormatting.None);
4246

43-
writer.WriteRaw(bodyJson + "\n");
47+
writer.WriteRaw(bodyJson);
48+
writer.WriteRaw("\n");
4449
}
4550
}
4651

0 commit comments

Comments
 (0)