Skip to content

Commit

Permalink
perf: read json to memory before parsing (#991)
Browse files Browse the repository at this point in the history
make reading json files faster by using bigger buffers
  • Loading branch information
wolfv authored Dec 19, 2024
1 parent b8250ef commit 48bda63
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions crates/rattler_conda_types/src/package/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ mod package_metadata;
mod paths;
mod run_exports;

use std::fs::File;
use std::io::Read;
use std::path::Path;
pub use {
Expand Down Expand Up @@ -71,7 +70,7 @@ pub trait PackageFile: Sized {
/// the specified path, parse the JSON string and return the resulting object. If the file is
/// not in a parsable format or if the file could not read, this function returns an error.
fn from_path(path: impl AsRef<Path>) -> Result<Self, std::io::Error> {
Self::from_reader(File::open(path)?)
Self::from_str(&fs_err::read_to_string(path)?)
}

/// Parses the object by looking up the appropriate file from the root of the specified Conda
Expand Down

0 comments on commit 48bda63

Please sign in to comment.