Unverified Commit a76d72f3 authored by Niklas Adolfsson's avatar Niklas Adolfsson
Browse files

pre-allocate string for batches

parent dbd30e28
Pipeline #200992 passed with stages
in 5 minutes and 23 seconds
......@@ -271,7 +271,10 @@ pub struct BatchResponseBuilder {
impl BatchResponseBuilder {
/// Create a new batch response builder with limit.
pub fn new_with_limit(limit: usize) -> Self {
Self { result: String::from("["), max_response_size: limit }
let mut initial = String::with_capacity(2048);
Self { result: initial, max_response_size: limit }
/// Append a result from an individual method to the batch response.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment