summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2016-09-21 20:47:40 -0400
committerAndrew Gallant <jamslam@gmail.com>2016-09-21 20:47:40 -0400
commit5a9883d27c018256c45e450764cf711fe53ce0f3 (patch)
tree084225ef19c387914b224c9baf0775e3b07b0fbe
parentf462d092e7f5c4e9a9b6da0b6b6c240f6b776f9e (diff)
Try to use memory maps more aggressively on Windows.
Some brief playing around suggests that it is faster. However, it's probably slower in a VM. Let's prioritize native users.
-rw-r--r--src/args.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/args.rs b/src/args.rs
index 63080703..77210a8f 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -131,7 +131,7 @@ Less common options:
--mmap
Search using memory maps when possible. This is enabled by default
when ripgrep thinks it will be faster. (Note that mmap searching
- doesn't current support the various context related options.)
+ doesn't currently support the various context related options.)
--no-mmap
Never use memory maps, even when they might be faster.
@@ -273,6 +273,9 @@ impl RawArgs {
false
} else if self.flag_mmap {
true
+ } else if cfg!(windows) {
+ // On Windows, memory maps appear faster than read calls. Neat.
+ true
} else {
// If we're only searching a few paths and all of them are
// files, then memory maps are probably faster.