27 lines
676 B
TOML
Raw Permalink Normal View History

2015-10-06 18:35:41 +08:00
[package]
name = "which"
2023-01-20 17:11:35 +08:00
version = "4.4.0"
edition = "2018"
authors = ["Harry Fei <tiziyuanfang@gmail.com>"]
repository = "https://github.com/harryfei/which-rs.git"
documentation = "https://docs.rs/which/"
2015-10-06 18:35:41 +08:00
license = "MIT"
2018-12-02 08:59:38 +01:00
description = "A Rust equivalent of Unix command \"which\". Locate installed executable in cross platforms."
2018-02-27 16:56:55 +08:00
readme = "README.md"
2017-10-05 00:08:55 +08:00
categories = ["os", "filesystem"]
2017-06-14 11:04:15 +08:00
keywords = ["which", "which-rs", "unix", "command"]
2016-06-07 14:02:38 -04:00
[dependencies]
2022-02-05 14:56:46 +08:00
either = "1.6.1"
libc = "0.2.121"
regex = { version = "1.5.5", optional = true }
2018-11-26 16:40:38 -08:00
Windows: various performance optimisations • Parse PATHEXT once only, with the new platform-specific dependency lazy_static. (If anyone changes PATHEXT in the middle of process invocation, I don’t even want to *know* what they’re doing.) This should reduce allocations on subsequent calls by at least 13 on a typical machine. • Skip an unnecessary clone of that Vec, and of every item in it. That’s another dozen or so allocations saved on every call. • Make has_executable_extension take &[S] instead of &Vec<S>, in line with accepted Best Practices™. There’s probably no difference in the compiled artefact, because the optimiser will already have been fixing it. • Remove the broken PATHEXT fallback case handling. It was intended to make it support .exe if PATHEXT was missing or non-Unicode, but due to using EXE_EXTENSION ("exe") instead of EXE_SUFFIX (".exe"), it actually matched the .xe extension. I contemplated fixing that and making it use .unwrap_or_else(|| …) instead of .unwrap_or(…) to save another allocation, but decided that it was better not to include that fallback anyway: for PATHEXT to be missing or non-Unicode is a severe breach of contract, and I doubt Windows would actually work properly; so there’s no need for such a dubious fallback. There are still further performance optimisations that can be made, most notably around performing exact allocations rather than just converting to a PathBuf and pushing bytes willy-nilly, which may require reallocation. But this lot is a good start.
2018-12-19 11:41:04 +11:00
[target.'cfg(windows)'.dependencies]
once_cell = "1"
Windows: various performance optimisations • Parse PATHEXT once only, with the new platform-specific dependency lazy_static. (If anyone changes PATHEXT in the middle of process invocation, I don’t even want to *know* what they’re doing.) This should reduce allocations on subsequent calls by at least 13 on a typical machine. • Skip an unnecessary clone of that Vec, and of every item in it. That’s another dozen or so allocations saved on every call. • Make has_executable_extension take &[S] instead of &Vec<S>, in line with accepted Best Practices™. There’s probably no difference in the compiled artefact, because the optimiser will already have been fixing it. • Remove the broken PATHEXT fallback case handling. It was intended to make it support .exe if PATHEXT was missing or non-Unicode, but due to using EXE_EXTENSION ("exe") instead of EXE_SUFFIX (".exe"), it actually matched the .xe extension. I contemplated fixing that and making it use .unwrap_or_else(|| …) instead of .unwrap_or(…) to save another allocation, but decided that it was better not to include that fallback anyway: for PATHEXT to be missing or non-Unicode is a severe breach of contract, and I doubt Windows would actually work properly; so there’s no need for such a dubious fallback. There are still further performance optimisations that can be made, most notably around performing exact allocations rather than just converting to a PathBuf and pushing bytes willy-nilly, which may require reallocation. But this lot is a good start.
2018-12-19 11:41:04 +11:00
[dev-dependencies]
tempfile = "3.3.0"
[package.metadata.docs.rs]
all-features = true