Skip to content

Better startup times through --dev #179

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

Merged
merged 2 commits into from
Jul 16, 2017

Conversation

PragTob
Copy link
Contributor

@PragTob PragTob commented Jul 14, 2017

Opposed to what I said in rspec/rspec-core#2444 there is something
we can do, I just underestimated its effect. There is --dev
(see https://github.com/jruby/jruby/wiki/Improving-startup-time#use-the---dev-flag).

Locally for the rspec-core --bisect spec this brought the runtime
down from 33 to 36 seconds to 21 seconds!

It also encompasses disabling invoke dynamic already, so no need
for that. It is opposed to server mode that was used however,
server mode targets peak performance at the cost of bigger startup
and warmup times and is usually intended for running on the server/
benchmarks. It was introduced for no reason apparent to me in
bc0b976 and I think --dev fits the use case better and is
closer to what most peeps probably run either way.

Other changes I did:

  • collapsed all the envs into one, it shouldn't hurt the other
    elements in the matrix, we lose the compat version 2.0 but
    that doesn't seem too important atm if it is please tell me
  • updated the JRuby version to the most current one

runtime comparison:

tobi@speedy ~/github/rspec-core $ JRUBY_OPTS='--dev' /usr/bin/time -v bundle exec cucumber features/command_line/bisect.feature:49
Using the default profile...
..............

1 scenario (1 passed)
10 steps (10 passed)
0m18.887s
	Command being timed: "bundle exec cucumber features/command_line/bisect.feature:49"
	User time (seconds): 34.66
	System time (seconds): 1.86
	Percent of CPU this job got: 166%
	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:21.90
	Average shared text size (kbytes): 0
	Average unshared data size (kbytes): 0
	Average stack size (kbytes): 0
	Average total size (kbytes): 0
	Maximum resident set size (kbytes): 255208
	Average resident set size (kbytes): 0
	Major (requiring I/O) page faults: 0
	Minor (reclaiming a frame) page faults: 883560
	Voluntary context switches: 179267
	Involuntary context switches: 2421
	Swaps: 0
	File system inputs: 0
	File system outputs: 1480
	Socket messages sent: 0
	Socket messages received: 0
	Signals delivered: 0
	Page size (bytes): 4096
	Exit status: 0
tobi@speedy ~/github/rspec-core $ JRUBY_OPTS='--server' /usr/bin/time -v bundle exec cucumber features/command_line/bisect.feature:49
Using the default profile...
..............

1 scenario (1 passed)
10 steps (10 passed)
0m28.057s
	Command being timed: "bundle exec cucumber features/command_line/bisect.feature:49"
	User time (seconds): 130.19
	System time (seconds): 2.73
	Percent of CPU this job got: 399%
	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:33.28
	Average shared text size (kbytes): 0
	Average unshared data size (kbytes): 0
	Average stack size (kbytes): 0
	Average total size (kbytes): 0
	Maximum resident set size (kbytes): 358952
	Average resident set size (kbytes): 0
	Major (requiring I/O) page faults: 0
	Minor (reclaiming a frame) page faults: 1499933
	Voluntary context switches: 95373
	Involuntary context switches: 14464
	Swaps: 0
	File system inputs: 0
	File system outputs: 1480
	Socket messages sent: 0
	Socket messages received: 0
	Signals delivered: 0
	Page size (bytes): 4096
	Exit status: 0

Opposed to what I said in rspec/rspec-core#2444 there is something
we can do, I just underestimated its effect. There is `--dev`
(see https://github.com/jruby/jruby/wiki/Improving-startup-time#use-the---dev-flag).

Locally for the rspec-core --bisect spec this brought the runtime
down from 33 to 36 seconds to 21 seconds!

It also encompasses disabling invoke dynamic already, so no need
for that. It is opposed to server mode that was used however,
server mode targets peak performance at the cost of bigger startup
and warmup times and is usually intended for running on the server/
benchmarks. It was introduced for no reason apparent to me in
bc0b976 and I think --dev fits the use case better and is
closer to what most peeps probably run either way.

Other changes I did:

* collapsed all the envs into one, it shouldn't hurt the other
  elements in the matrix, we lose the compat version 2.0 but
  that doesn't seem too important atm if it is please tell me
* updated the JRuby version to the most current one
@myronmarston
Copy link
Member

Thanks for finding that! I've opened PRs for each of the repos with this update:

Assuming it has the intended effect (as I expect it to), I'll be glad to merge this :).

@PragTob
Copy link
Contributor Author

PragTob commented Jul 15, 2017

Thank you! 👍 🎉

PragTob added a commit to PragTob/rspec-core that referenced this pull request Jul 15, 2017
Startup time is still very much a problem with JRuby, hence
feature type aruba cukes that invoke rspec a lot of times
are still problematic. The bisect specs do this to the extreme,
resulting in long spec run times. Locally a single scenario
takes 36 seconds to run for me, on a 4-core desktop computer.
An overloaded CI might take longer, hence just double the timeout
and hope it's enough. Nothing much else we can do, but try using
--dev see rspec/rspec-dev#179

ref: rspec#2442
@PragTob
Copy link
Contributor Author

PragTob commented Jul 15, 2017

Grrml I just checked the other PRs, and it seems that (once again) my drive by updates of course caused problems, newest JRuby seems to be failing. I'll revert that back to the version you were testing with before and then we can figure out/fix newer JRuby versions in separate PRs. :'(

@myronmarston
Copy link
Member

Thanks, @PragTob. New batch of PRs:

Regarding updating the version of JRuby: a couple of the failures are for pending specs for bugs in JRuby that are apparently fixed, which is good :). For rspec-core, there are some formatter specs that get slightly different output on the new version of JRuby, so we just have to update those. I don't think updating the JRuby version will be too bad, but agree with doing it as a separate step.

@PragTob
Copy link
Contributor Author

PragTob commented Jul 15, 2017

@myronmarston the PRs don't seem to have picked up the latest change, they still specify 9.1.12.0 but I changed it back to 9.1.2.0 :)

@myronmarston myronmarston merged commit 50e0989 into rspec:master Jul 16, 2017
@myronmarston
Copy link
Member

Thanks, @PragTob!

@PragTob PragTob deleted the adjust-jruby-opts-on-travis branch July 16, 2017 08:25
MatheusRich pushed a commit to MatheusRich/rspec-core that referenced this pull request Oct 30, 2020
Startup time is still very much a problem with JRuby, hence
feature type aruba cukes that invoke rspec a lot of times
are still problematic. The bisect specs do this to the extreme,
resulting in long spec run times. Locally a single scenario
takes 36 seconds to run for me, on a 4-core desktop computer.
An overloaded CI might take longer, hence just double the timeout
and hope it's enough. Nothing much else we can do, but try using
--dev see rspec/rspec-dev#179

ref: rspec#2442
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

Successfully merging this pull request may close these issues.

2 participants