なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2015/07/30)

2015/07/30分のコミットです。

CHANGELOGへの追加はありませんでした。


Make silence a warning inserted by commit #4b3f8ac

actionmailer/test/i18n_with_controller_test.rbの修正です。

Add deprecation warning for render :text の対応により、send_mailを使用したテストで deprecation warningが出るようになってしまったので、ActiveSupport::Deprecation.silenceメソッドを使用してwarningメッセージ表示されないよう対応しています。


Fix reported regression rails/sprockets-rails#265

railties/test/application/assets_test.rbの修正です。

実際必要になるまでcompressorsをロードしない事を確認するテストが、sprockets-railsFix performance regression in Rails helper by eileencodes · Pull Request #265 · rails/sprockets-railsによりコケるようになってしまったのを対応しています。

上記 sprcoket-railsのコミットは、app/assets をload pathに追加したAdd app/assets to the load path. by lucasmazza · Pull Request #232 · rails/sprockets-railsの対応により、大きなperformance regression(Adding app/ to the asset path is a large performance regression · Issue #234 · rails/sprockets-rails)が発生してしまい、その対応として行われたコミットでした。

assets precompileをチェックする対象が増えてしまったことによりperformance regressionが発生してしまったようで、Fix performance regression in Rails helper by eileencodes · Pull Request #265 · rails/sprockets-railsではprecompiled_assetsを明示的に指定出来るようにし、performance regressionに対応しています。(precompiled_assetsが設定されていた場合はassets precompileが実行されない為。テスト実行時に使う想定かな)

その対応の影響で、assets.compileがtrueの場合、必ずassets.precompileを参照するようになってしまい、assets.compileがtrueなのに、assets.precompileが設定されていない為、エラーになりテストがコケてしまっていした。

とりあえずテストについては、assets.precompile = []を設定し、対応したようです。


Fix rake/notes_test

railties/test/application/rake/notes_test.rbの修正です。

こちらも先のコミット同様、 config.assets.precompileを設定するよう修正しています。


Decrease string allocations on AR#respond_to?

activerecord/lib/active_record/attribute_methods.rbの修正です。

ActiveRecord#respond_to?メソッドで、引数のnameに:to_partial_path、または:to_modelが渡された場合、Stringへの変換処理を行わないよう修正しています。

String objectのインスタンス生成を削減し、性能改善のための対応です。

以降、同様に性能改善のコミットが続きます。


Decrease string allocations in apply_inflections

activesupport/lib/active_support/inflector/inflections.rbactivesupport/lib/active_support/inflector/methods.rbの修正です。

apply_inflectionsメソッドに、不可算な値が指定された場合、不要なStringの変換処理(downcase、空白の除去)等を行わないよう修正しています。


Decrease string allocations in url_options

actionpack/lib/action_controller/metal/url_for.rbの修正です。

url_optionsメソッドで、script_nameが空だった場合に不要なString objectを生成しないよう修正しています。


Speed up journey extract_parameterized_parts

actionpack/lib/action_dispatch/journey/formatter.rbの修正です。

reverse.drop_whileを使用していた箇所をreverse_each.drop_whileに修正しています。

reverse_eachの方がオブジェクト生成を行わないので早いとの事。


Speed up journey missing_keys

actionpack/lib/action_dispatch/journey/formatter.rbの修正です。

missing_keysメソッドで、不要なRegex objectを生成しないで済むよう、keyのチェック処理を改善しています。


Decrease route_set allocations

actionpack/lib/action_dispatch/routing/route_set.rbの修正です。

不要なArrayのインスタンスを生成しないよう処理を修正しています。


Reduce hash allocations in route_set

actionpack/lib/action_dispatch/routing/route_set.rbの修正です。

コンストラクタで引数のrecalldupしていたのを、dupしないよう修正しています。

テストは通ったのでおそらく問題無いだろう、とのですが、何か問題があったらrevertしてとの事です。


Decrease string allocation in content_tag_string

actionview/lib/action_view/helpers/tag_helper.rbの修正です。

固定で使用している文字列をfreezeして、String objectを使いまわすよう修正しています。


Optimize hash key

actionview/lib/action_view/helpers/url_helper.rbの修正です。

固定で使用している文字列をfreezeして、String objectを使いまわすよう修正しています。


Cut string ActionView template allocations

actionview/lib/action_view/template.rbの修正です。

固定で使用している文字列をfreezeして、String objectを使いまわすよう修正しています。


Cut string allocations in content_tag_string

ActionView helpers配下まとめての修正です。

固定で使用している文字列をfreezeして、String objectを使いまわすよう修正しています。

性能改善対応のコミットはここまで。


Remove yepnope mention from form helpers guide because it's deprecated [ci skip]

rails guideのForm Helpersの修正です。

Other Helpers of Interestの項、外部ツールについて説明している箇所からdeprecateになっているyepnope.js | A Conditional Loader For Your Polyfills! を削除しています。