On March 2nd, 2023, I read a tip in Ruby Weekly.
!value.nil? is a lot faster than value != nil
It’s nearly 5 times faster, so I want to update my code base accordingly.
I open the Synvert app, copy the code from the tip and paste them into inputs and expected outputs.
Then I click the “Generate Snippet” button, and Synvert generates a snippet for me.
After reviewing the snippet, I click the “Search” button, and Synvert finds all occurrences of value != nil
in my code base.
I can selectively apply the changes or click “Replace All” button to apply them all at once.
I can run git diff
to view all changes in my code base.
Share this post