nom icon indicating copy to clipboard operation
nom copied to clipboard

length_count: use Vec::with_capacity

Open tanriol opened this issue 4 years ago • 0 comments

This change avoids reallocation while filling in the array. In my case this causes a ~20% perf increase.

This might cause regressions if some users rely on nom not allocating the whole array before an error happens, causing their parsers to change behavior from "starts parsing, encounters an error, backtracks to a previous alt/opt/whatever" to "starts parsing, causes an OOM abort". I don't think nom provides any guarantees in either direction.

tanriol avatar Nov 13 '21 23:11 tanriol