Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ pub fn command_json_get<M: Manager>(
let mut args = args.into_iter().skip(1);
let key = args.next_arg()?;

let mut paths: Vec<Path> = vec![];
// Set Capcity to 1 assumiung the common case has one path
let mut paths: Vec<Path> = Vec::with_capacity(1);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If indeed the common usage is a single path arg - we could benefit from this, since
Looking at raw_vec.rs, before this change, MIN_NON_ZERO_CAP would be 4 (since push will call reserve(1) when the initial len and capacity are zero in mod.rs)

let mut format = Format::JSON;
let mut indent = None;
let mut space = None;
Expand Down