Skip to content

Commit 87f3ec9

Browse files
committed
perf: preallocate vector size
1 parent cbe47b2 commit 87f3ec9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn read_points<'py>(py: Python<'py>, filepath: &str) -> PyResult<&'py PyArray<f6
3838
};
3939
let pc = file.pointclouds();
4040
let pc = pc.first().expect("files contain pointclouds");
41-
let mut vec = Vec::new();
41+
let mut vec = Vec::with_capacity(pc.records as usize);
4242
let iter = file
4343
.pointcloud(pc)
4444
.expect("this file contains a pointcloud");

0 commit comments

Comments
 (0)