Skip to content
Snippets Groups Projects
Commit e4f14c88 authored by ale's avatar ale
Browse files

Allocation optimization

parent dd3d5b49
No related branches found
No related tags found
No related merge requests found
......@@ -82,6 +82,10 @@ func RecordToTuples(record []byte) ([]Tuple, []TypeError, error) {
return nil, nil, err
}
tuples, unprocessed := flatten(m, "", nil, nil)
// Allocation optimization: assume the incoming record is
// flat-ish and preallocate a Tuple slice.
tupleBuf := make([]Tuple, 0, len(m))
tuples, unprocessed := flatten(m, "", tupleBuf, nil)
return tuples, unprocessed, nil
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment