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

use String#match? for speed in 'usable?' helper #210

Merged
merged 4 commits into from
Feb 9, 2023
Merged

use String#match? for speed in 'usable?' helper #210

merged 4 commits into from
Feb 9, 2023

Conversation

markets
Copy link
Collaborator

@markets markets commented Feb 8, 2023

Closes #209

Since part of the build is broken, you can test these changes by running only the usable? related specs:

bundle exec rspec spec/lib/video_info/providers/dailymotion_spec.rb:5 && 
bundle exec rspec spec/lib/video_info/providers/vimeo_spec.rb:9 && 
bundle exec rspec spec/lib/video_info/providers/wistia_spec.rb:5 && 
bundle exec rspec spec/lib/video_info/providers/wistia_spec.rb:5 && 
bundle exec rspec spec/lib/video_info/providers/youtube_spec.rb:9 &&
bundle exec rspec spec/lib/video_info/providers/youtube_playlist_spec.rb:9
All those specs passes ✅
Run options: include {:focus=>true, :locations=>{"./spec/lib/video_info/providers/dailymotion_spec.rb"=>[5]}}

VideoInfo::Providers::Dailymotion
  .usable?
    with dailymotion url
      is expected to be truthy
    with dai.ly url
      is expected to be truthy
    with other url
      is expected to be falsey

Finished in 0.00431 seconds (files took 0.68204 seconds to load)
3 examples, 0 failures

Run options: include {:focus=>true, :locations=>{"./spec/lib/video_info/providers/vimeo_spec.rb"=>[9]}}

VideoInfo::Providers::Vimeo
  .usable?
    with vimeo url
      is expected to be truthy
    with Vimeo OnDemand url
      is expected to be truthy
    with Vimeo Channels url
      is expected to be truthy
    with Vimeo Review url
      is expected to be truthy
    with vimeo album url
      is expected to be falsey
    with vimeo hubnub embed url
      is expected to be falsey
    with other url
      is expected to be falsey

VideoInfo::Providers::Vimeo
  .usable?
    with vimeo url
      is expected to be truthy
    with Vimeo OnDemand url
      is expected to be truthy
    with Vimeo Channels url
      is expected to be truthy
    with Vimeo Review url
      is expected to be truthy
    with vimeo album url
      is expected to be falsey
    with vimeo hubnub embed url
      is expected to be falsey
    with other url
      is expected to be falsey

Finished in 0.01706 seconds (files took 0.73523 seconds to load)
14 examples, 0 failures

Run options: include {:focus=>true, :locations=>{"./spec/lib/video_info/providers/wistia_spec.rb"=>[5]}}

VideoInfo::Providers::Wistia
  .usable?
    with wistia url
      is expected to be truthy
    with other url
      is expected to be falsey

Finished in 0.00542 seconds (files took 0.6773 seconds to load)
2 examples, 0 failures

Run options: include {:focus=>true, :locations=>{"./spec/lib/video_info/providers/wistia_spec.rb"=>[5]}}

VideoInfo::Providers::Wistia
  .usable?
    with wistia url
      is expected to be truthy
    with other url
      is expected to be falsey

Finished in 0.00537 seconds (files took 0.66738 seconds to load)
2 examples, 0 failures

Run options: include {:focus=>true, :locations=>{"./spec/lib/video_info/providers/youtube_spec.rb"=>[9]}}

VideoInfo::Providers::Youtube
  .usable?
    with youtube.com url
      is expected to be truthy
    with youtu.be url
      is expected to be truthy
    with other url
      is expected to be falsey
    with playlist url
      is expected to be falsey

VideoInfo::Providers::Youtube
  .usable?
    with youtube.com url
      is expected to be truthy
    with youtu.be url
      is expected to be truthy
    with other url
      is expected to be falsey
    with playlist url
      is expected to be falsey

Finished in 0.01486 seconds (files took 0.76922 seconds to load)
8 examples, 0 failures

Run options: include {:focus=>true, :locations=>{"./spec/lib/video_info/providers/youtube_playlist_spec.rb"=>[9]}}

VideoInfo::Providers::YoutubePlaylist
  .usable?
    with youtube.com/playlist?p= url
      is expected to be truthy
    with youtube.com/playlist?list= url
      is expected to be truthy
    with youtube.com url
      is expected to be falsey
    with other url
      is expected to be falsey

Finished in 0.00645 seconds (files took 0.6691 seconds to load)
4 examples, 0 failures

EXTRAS

  • b793210 Updated and simplified unit_test.yml CI workflow with new actions and new Ruby versions. The build is still broken, but at least now it runs on CI, so we have an idea (ℹ️ 409 examples, 64 failures) and it will be useful to fix them.
  • eddfab3 Remove temporal file (tmp/rspec_guard_result)

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

.rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
.rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
.rubocop.yml: Style/FileName has the wrong namespace - should be Naming
.rubocop.yml: Style/PredicateName has the wrong namespace - should be Naming
.rubocop.yml: Style/AccessorMethodName has the wrong namespace - should be Naming
Error: The `Style/TrailingCommaInLiteral` cop no longer exists. Please use `Style/TrailingCommaInArrayLiteral` and/or `Style/TrailingCommaInHashLiteral` instead.
(obsolete configuration found in .rubocop.yml, please update it)
obsolete parameter MaxLineLength (for Style/IfUnlessModifier) found in .rubocop.yml
`Style/IfUnlessModifier: MaxLineLength` has been removed. Use `Metrics/LineLength: Max` instead

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

.rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
.rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
.rubocop.yml: Style/FileName has the wrong namespace - should be Naming
.rubocop.yml: Style/PredicateName has the wrong namespace - should be Naming
.rubocop.yml: Style/AccessorMethodName has the wrong namespace - should be Naming
Error: The `Style/TrailingCommaInLiteral` cop no longer exists. Please use `Style/TrailingCommaInArrayLiteral` and/or `Style/TrailingCommaInHashLiteral` instead.
(obsolete configuration found in .rubocop.yml, please update it)
obsolete parameter MaxLineLength (for Style/IfUnlessModifier) found in .rubocop.yml
`Style/IfUnlessModifier: MaxLineLength` has been removed. Use `Metrics/LineLength: Max` instead

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

.rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
.rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
.rubocop.yml: Style/FileName has the wrong namespace - should be Naming
.rubocop.yml: Style/PredicateName has the wrong namespace - should be Naming
.rubocop.yml: Style/AccessorMethodName has the wrong namespace - should be Naming
Error: The `Style/TrailingCommaInLiteral` cop no longer exists. Please use `Style/TrailingCommaInArrayLiteral` and/or `Style/TrailingCommaInHashLiteral` instead.
(obsolete configuration found in .rubocop.yml, please update it)
obsolete parameter MaxLineLength (for Style/IfUnlessModifier) found in .rubocop.yml
`Style/IfUnlessModifier: MaxLineLength` has been removed. Use `Metrics/LineLength: Max` instead

Copy link
Owner

@thibaudgg thibaudgg left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for the CI update. 👍 Just one comment.

Comment on lines -1 to -25
104 examples, 24 failures in 42.5583 seconds
./spec/lib/video_info/providers/dailymotion_spec.rb:134
./spec/lib/video_info/providers/dailymotion_spec.rb:139
./spec/lib/video_info/providers/dailymotion_spec.rb:144
./spec/lib/video_info/providers/dailymotion_spec.rb:159
./spec/lib/video_info/providers/vimeo_spec.rb:108
./spec/lib/video_info/providers/vimeo_spec.rb:115
./spec/lib/video_info/providers/vimeo_spec.rb:120
./spec/lib/video_info/providers/vimeo_spec.rb:128
./spec/lib/video_info/providers/vimeo_spec.rb:133
./spec/lib/video_info/providers/vimeo_spec.rb:138
./spec/lib/video_info/providers/vimeo_spec.rb:143
./spec/lib/video_info/providers/vimeo_spec.rb:152
./spec/lib/video_info/providers/vimeo_spec.rb:158
./spec/lib/video_info/providers/vimeo_spec.rb:164
./spec/lib/video_info/providers/vimeo_spec.rb:180
./spec/lib/video_info/providers/vimeo_spec.rb:197
./spec/lib/video_info/providers/vimeo_spec.rb:202
./spec/lib/video_info/providers/vimeo_spec.rb:207
./spec/lib/video_info/providers/vimeo_spec.rb:212
./spec/lib/video_info/providers/vimeo_spec.rb:308
./spec/lib/video_info/providers/vimeo_spec.rb:309
./spec/lib/video_info/providers/vimeo_spec.rb:310
./spec/lib/video_info/providers/vimeo_spec.rb:311
./spec/lib/video_info/providers/vimeo_spec.rb:54
Copy link
Owner

Choose a reason for hiding this comment

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

We should git ignore that file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done in 👉🏼 261c0bf

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

.rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
.rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
.rubocop.yml: Style/FileName has the wrong namespace - should be Naming
.rubocop.yml: Style/PredicateName has the wrong namespace - should be Naming
.rubocop.yml: Style/AccessorMethodName has the wrong namespace - should be Naming
Error: The `Style/TrailingCommaInLiteral` cop no longer exists. Please use `Style/TrailingCommaInArrayLiteral` and/or `Style/TrailingCommaInHashLiteral` instead.
(obsolete configuration found in .rubocop.yml, please update it)
obsolete parameter MaxLineLength (for Style/IfUnlessModifier) found in .rubocop.yml
`Style/IfUnlessModifier: MaxLineLength` has been removed. Use `Metrics/LineLength: Max` instead

@thibaudgg thibaudgg merged commit 5676816 into thibaudgg:master Feb 9, 2023
@markets markets deleted the regexp_perf branch February 9, 2023 20:29
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.

Improve performance of usable? helper
3 participants