Skip to content
New issue

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

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

Already on GitHub? # to your account

Improve spec speed #537

Merged
merged 4 commits into from
Mar 17, 2016
Merged

Improve spec speed #537

merged 4 commits into from
Mar 17, 2016

Conversation

petems
Copy link
Member

@petems petems commented Mar 17, 2016

Removes large fixture file, even for non 1.9.3 …

  • The test is to make sure that json is used
  • The size of the json is irrelevant really, just that the right library is used and the json is parsed.
  • Speeds up test suite a gobsmacking amount with parallel tests (~10 mins -> 1 minute)

Adds parallel tests rake task …

Comparison on an 8 core Mac:

$ bundle exec rake parallel_spec
746 examples, 0 failures, 10 pendings

Took 93 seconds (1:33)

Vs Vanilla spec:

$ bundle exec rake spec
Finished in 3 minutes 4.8 seconds (files took 2.14 seconds to load)
746 examples, 0 failures, 10 pending

Changes travis to use parallel specs

Lets speed up that CI!

* The test is to make sure that json is used
* The size of the json is irrelevant really, just that the right library is used and the json is parsed.
* Speeds up test suite a gobsmacking amount with parallel tests (~10 mins -> 1 minute)
task :parallel_spec do
require 'parallel_tests/cli'
Rake::Task[:spec_prep].invoke
ParallelTests::CLI.new.run('--type test -t rspec spec/classes spec/defines spec/unit'.split)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn just realised I forgot functions, I did think the speed increase was a little too impressive...

EDIT: nvm, functions is only 2 tests, this is speedy 🚗

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, there's only 2 specs in there, this thing really is fast! 💯

@jenkinsadmin
Copy link

Thank you for this pull request! Please check this document for how the Jenkins project handles pull requests.

@petems petems force-pushed the improve_spec_speed branch 2 times, most recently from e0f3082 to 7906cd4 Compare March 17, 2016 00:10
@petems
Copy link
Member Author

petems commented Mar 17, 2016

Note: Repeated running on a dev machine make this faster: ParallelTests::RSpec::RuntimeLogger sorts tests into profiled chunks, decreasing running time 👍

petems added 2 commits March 17, 2016 00:23
Also moves parallel_tests out of development group so it's installed on travis

Comparison on an 8 core Mac:

```
$ bundle exec rake parallel_spec
746 examples, 0 failures, 10 pendings

Took 66 seconds (1:06)
```

Vs.

```
$ bundle exec rake spec
Finished in 3 minutes 4.8 seconds (files took 2.14 seconds to load)
746 examples, 0 failures, 10 pending
```
@petems petems force-pushed the improve_spec_speed branch from 7906cd4 to 2301f95 Compare March 17, 2016 00:24
@petems
Copy link
Member Author

petems commented Mar 17, 2016

Consistant 2 mins ~ specs in Travis 🎆

@rtyler
Copy link

rtyler commented Mar 17, 2016

Travis doesn't like you @petems

Please use --help for a listing of valid options
invalid option: --random (defined in ENV['SPEC_OPTS'])

@petems petems force-pushed the improve_spec_speed branch from e589cd4 to 69e2bb2 Compare March 17, 2016 08:35
@petems
Copy link
Member Author

petems commented Mar 17, 2016

Whoops, should be fixed now! 😓

rtyler pushed a commit that referenced this pull request Mar 17, 2016
@rtyler rtyler merged commit 5d02d92 into voxpupuli:master Mar 17, 2016
@rtyler
Copy link

rtyler commented Mar 17, 2016

WHOOO

@rtyler rtyler added this to the 1.7.0 - Oddjob milestone Mar 17, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants