Preallocate a buffer in FmtPrinter
This commit is contained in:
parent
efb99d780d
commit
2ee6d55c62
1 changed files with 3 additions and 1 deletions
|
@ -1583,7 +1583,9 @@ impl<'a, 'tcx> FmtPrinter<'a, 'tcx> {
|
|||
pub fn new(tcx: TyCtxt<'tcx>, ns: Namespace) -> Self {
|
||||
FmtPrinter(Box::new(FmtPrinterData {
|
||||
tcx,
|
||||
fmt: String::new(),
|
||||
// Estimated reasonable capacity to allocate upfront based on a few
|
||||
// benchmarks.
|
||||
fmt: String::with_capacity(64),
|
||||
empty_path: false,
|
||||
in_value: ns == Namespace::ValueNS,
|
||||
print_alloc_ids: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue