Reduce subshells #57

Merged
merged 2 commits into from Dec 5, 2011

2 participants

@tenderlove

Rails boot seems to be spending a lot of time creating subshells. These two commits should reduce the subshells that ExecJS creates by implementing which in Ruby. File stats are reduced by lazily searching for the executable.

I made a similar change to bundler.

Thanks!

@josh josh merged commit aaa25c4 into sstephenson:master Dec 5, 2011
@josh josh commented on the diff Dec 5, 2011
lib/execjs/external_runtime.rb
end
+ private
+ def binary
+ @binary ||= locate_binary
+ end
+
+ def which_windows(name)
+ result = `#{shell_escape("#{ExecJS.root}/support/which.bat", name)}`
+ result.strip.split("\n").first
+ end
+
+ def which_unix(name)
+ if File.executable? cmd
@josh
josh added a note Dec 5, 2011

name vs cmd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@josh

Fixed 9329d2b

@luislavena luislavena referenced this pull request Dec 6, 2011
Merged

Remove subshells windows #58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment