git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: [PATCH v3] Add git-grep threads param

From
VLVictor Leschuk <vleschuk@accesssoftek.com>
Date
Oct 27, 2015, 09:14 UTC
Message-ID
<6AE1604EE3EC5F4296C096518C6B77EE5D0FDAB9FE@mail.accesssoftek.com>
In-Reply-To
<CA+55aFwrU25x25XrRODgS1oRXqN60rmYPiXLgfs3mqRco4Oi9A@mail.gmail.com>
Hello Linus, 
>> According to several tests on systems with different number of CPU cores
>> the hard-coded number of 8 threads is not optimal for all systems:
> Did you also compare cold-cache filesystem performance?
>  One of the reasons for doing threaded grep is for CPU scaling. But another is for IO scaling. If your git tree is over NFS, doing grep eight threads at a time if likely going to make things much faster even if you are on a single CPU.
Yes, I have performed tests on cold-cache FS and it looks like number of threads affects performance. Here are the results for grepping linux kernel repo on a 4-core machine (similar test was conducted on 8-core machine):
Threads: 4 Time: 39.13
Threads: 8 Time: 34.39
Threads: 16 Time: 31.46
Threads: 32 Time: 27.40
Here is test scenario:
#!/bin/bash
TIMEFORMAT=%R
GIT=/home/del/git-dev/bin/git
TESTS=10
for n in 4 8 16 32; do
    echo -n "Threads: $n Time: "
    for i in $(seq 1 $TESTS); do
        echo 3 > /proc/sys/vm/drop_caches
        time $GIT grep --threads $n -e '#define' --and \( -e MAX_PATH -e PATH_MAX \)  >/dev/null
    done 2>&1 | awk -v ntests=${TESTS} '{sum+=$1} END{printf "%.2f\n", sum/ntests}'
done
Note: With hot-cache grepping with 4 threads gives fastest results on both 4-core and 8-core machines.
Thus I think it can be useful for users to be able to tune the threads number according to their needs.
Previous: John Keeping
Message 7 of 7 in “Add git-grep threads param”
  1. Add git-grep threads paramVictor Leschuk, Oct 26, 2015
  2. John KeepingOct 26, 2015
  3. Victor LeschukOct 27, 2015
  4. John KeepingOct 27, 2015
  5. Victor LeschukOct 27, 2015
  6. John KeepingOct 27, 2015
  7. Victor LeschukOct 27, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.