{"action":"created","issue":{"url":"https://api.github.com/repos/BurntSushi/ripgrep/issues/136","repository_url":"https://api.github.com/repos/BurntSushi/ripgrep","labels_url":"https://api.github.com/repos/BurntSushi/ripgrep/issues/136/labels{/name}","comments_url":"https://api.github.com/repos/BurntSushi/ripgrep/issues/136/comments","events_url":"https://api.github.com/repos/BurntSushi/ripgrep/issues/136/events","html_url":"https://github.com/BurntSushi/ripgrep/issues/136","id":180163882,"number":136,"title":"slowdown with many files on the command line, compared to no arguments","user":{"login":"oconnor663","id":860932,"avatar_url":"https://avatars.githubusercontent.com/u/860932?v=3","gravatar_id":"","url":"https://api.github.com/users/oconnor663","html_url":"https://github.com/oconnor663","followers_url":"https://api.github.com/users/oconnor663/followers","following_url":"https://api.github.com/users/oconnor663/following{/other_user}","gists_url":"https://api.github.com/users/oconnor663/gists{/gist_id}","starred_url":"https://api.github.com/users/oconnor663/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oconnor663/subscriptions","organizations_url":"https://api.github.com/users/oconnor663/orgs","repos_url":"https://api.github.com/users/oconnor663/repos","events_url":"https://api.github.com/users/oconnor663/events{/privacy}","received_events_url":"https://api.github.com/users/oconnor663/received_events","type":"User","site_admin":false},"labels":[{"id":339721678,"url":"https://api.github.com/repos/BurntSushi/ripgrep/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2016-09-29T21:10:03Z","updated_at":"2016-11-13T01:46:01Z","closed_at":null,"body":"Example using the https://github.com/keybase/client repo:\n\n```\n$ ls go/**/*.go | wc -l\n1352\n\n$ time rg blahblahblah go/       \nrg blahblahblah go/  0.03s user 0.01s system 210% cpu 0.017 total\n\n# <<< this is the slow one >>>\n$ time rg blahblahblah go/**/*.go\nrg blahblahblah go/**/*.go  0.14s user 0.01s system 104% cpu 0.137 total\n\n$ time grep blahblahblah -r go/  \ngrep --color=auto blahblahblah -r go/  0.01s user 0.01s system 92% cpu 0.014 total\n\n$ time grep blahblahblah go/**/*.go\ngrep --color=auto blahblahblah -r go/**/*.go  0.01s user 0.01s system 93% cpu 0.018 total\n```\n\nIt looks like `rg` is slower when given a (long) list of files on the command line, than it is when it has to find those files itself. `grep` doesn't have this problem, so I don't think it's some confounder like my shell taking a long time to expand the glob.\n"},"comment":{"url":"https://api.github.com/repos/BurntSushi/ripgrep/issues/comments/260160945","html_url":"https://github.com/BurntSushi/ripgrep/issues/136#issuecomment-260160945","issue_url":"https://api.github.com/repos/BurntSushi/ripgrep/issues/136","id":260160945,"user":{"login":"BurntSushi","id":456674,"avatar_url":"https://avatars.githubusercontent.com/u/456674?v=3","gravatar_id":"","url":"https://api.github.com/users/BurntSushi","html_url":"https://github.com/BurntSushi","followers_url":"https://api.github.com/users/BurntSushi/followers","following_url":"https://api.github.com/users/BurntSushi/following{/other_user}","gists_url":"https://api.github.com/users/BurntSushi/gists{/gist_id}","starred_url":"https://api.github.com/users/BurntSushi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BurntSushi/subscriptions","organizations_url":"https://api.github.com/users/BurntSushi/orgs","repos_url":"https://api.github.com/users/BurntSushi/repos","events_url":"https://api.github.com/users/BurntSushi/events{/privacy}","received_events_url":"https://api.github.com/users/BurntSushi/received_events","type":"User","site_admin":false},"created_at":"2016-11-13T01:46:01Z","updated_at":"2016-11-13T01:46:01Z","body":"OK, so I finally have ripgrep wired up to clap and I can confirm this issue in particular gets fixed. My test case with GNU grep:\r\n\r\n```\r\n[andrew@Cheetah linux] time sh ../cmd.grep\r\n./include/linux/ide.h:  REQ_TYPE_ATA_PM_RESUME, /* resume request */\r\n./include/linux/ide.h:   (rq)->cmd_type == REQ_TYPE_ATA_PM_RESUME)\r\n./include/linux/ide.h: * State information carried for REQ_TYPE_ATA_PM_SUSPEND and REQ_TYPE_ATA_PM_RESUME\r\n\r\nreal    0m0.182s\r\nuser    0m0.120s\r\nsys     0m0.043s\r\n```\r\n\r\nWith current ripgrep master:\r\n\r\n```\r\n[andrew@Cheetah linux] time sh ../cmd.rg \r\ninclude/linux/ide.h\r\n        REQ_TYPE_ATA_PM_RESUME, /* resume request */\r\n         (rq)->cmd_type == REQ_TYPE_ATA_PM_RESUME)\r\n * State information carried for REQ_TYPE_ATA_PM_SUSPEND and REQ_TYPE_ATA_PM_RESUME\r\n\r\nreal    0m1.025s\r\nuser    0m0.783s\r\nsys     0m0.240s\r\n```\r\n\r\nand finally with ripgrep wired up to clap:\r\n\r\n```\r\n[andrew@Cheetah linux] time sh ../cmd.rg \r\ninclude/linux/ide.h\r\n        REQ_TYPE_ATA_PM_RESUME, /* resume request */\r\n         (rq)->cmd_type == REQ_TYPE_ATA_PM_RESUME)\r\n * State information carried for REQ_TYPE_ATA_PM_SUSPEND and REQ_TYPE_ATA_PM_RESUME\r\n\r\nreal    0m0.106s\r\nuser    0m0.067s\r\nsys     0m0.037s\r\n```\r\n\r\nEverything is run single-threaded on 3,458 files explicitly given on the command line. This test case was derived from the following `xargs` command in the `linux` repo (notice how gosh dang slow ripgrep *was*):\r\n\r\n```\r\n$ time find ./ -type f | xargs grep PM_RESUME | wc -l\r\n16\r\n\r\nreal    0m1.170s\r\nuser    0m0.833s\r\nsys     0m0.483s\r\n$ time find ./ -type f | xargs rg-master -j1 PM_RESUME | wc -l\r\n16\r\n\r\nreal    0m17.562s\r\nuser    0m13.960s\r\nsys     0m3.753s\r\n$ time find ./ -type f | xargs rg -j1 PM_RESUME | wc -l\r\n16\r\n\r\nreal    0m1.136s\r\nuser    0m0.630s\r\nsys     0m0.670s\r\n```\r\n\r\nYay clap!"}}
{"actor":{"display_login":"BurntSushi"}}