mirror of
https://github.com/ml-explore/mlx.git
synced 2025-10-19 00:04:41 +08:00
Remove unnecessary string copies (#891)
1. Use string_view instead of string when there is no need for copy. 2. Otherwise move string when possible.
This commit is contained in:
@@ -60,10 +60,10 @@ struct buffer_info {
|
||||
std::vector<ssize_t> strides;
|
||||
|
||||
buffer_info(
|
||||
const std::string& format,
|
||||
std::string format,
|
||||
std::vector<ssize_t> shape_in,
|
||||
std::vector<ssize_t> strides_in)
|
||||
: format(format),
|
||||
: format(std::move(format)),
|
||||
shape(std::move(shape_in)),
|
||||
strides(std::move(strides_in)) {}
|
||||
|
||||
|
Reference in New Issue
Block a user