Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outrageously slow on Mac #31

Closed
schneems opened this issue Jul 4, 2019 · 1 comment
Closed

Outrageously slow on Mac #31

schneems opened this issue Jul 4, 2019 · 1 comment

Comments

@schneems
Copy link
Member

schneems commented Jul 4, 2019

We accidentally found a reproduction where derailed benchmarks is REALLY slow on a mac and 15x faster on a docker container on the SAME machine. Here's the repro: zombocom/derailed_benchmarks#136 (comment)

It looks like the vast majority of time is spent in get_process_mem

$ sudo --preserve-env rbspy record -- bundle exec derailed bundle:mem
$ rbspy report -f summary -i /Users/rschneeman/.cache/rbspy/records/rbspy-2019-07-04-1zuBautmfg.raw.gz --output summary.txt && cat summary.txt
% self  % total  name
 82.87    83.82  ps_memory - /Users/rschneeman/.gem/ruby/2.5.1/gems/get_process_mem-0.2.3/lib/get_process_mem.rb
 10.19    96.50  block (2 levels) in <top (required)> - /Users/rschneeman/.gem/ruby/2.5.1/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb

My theory is that the speed difference is due to shelling out to ps on a mac versus with linux we use the /proc file system.

If I replace the ps call with another system call such as echo 1000 then it still takes a long time (0m12.464s) however it is faster than the ps call. Removing the shell out entirely takes it down to 0m1.473s which is still slower than docker, but at least it's fast-ish. It looks like the majority of time comes from the shell out, then after than the ps command actually takes a long time to run. Finally there are some other mac/linux differences here, but this tells me we should focus on trying to remove the shell out command to ps somehow on get_process_mem

Maybe there is a faster way to get this data from mac.

@schneems
Copy link
Member Author

schneems commented Jul 8, 2019

Closed via #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant