aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Cut string allocations in content_tag_stringschneems2015-07-296-20/+20
| | | | | | content_tag's first argument is will generate a string with an html tag so `:a` will generate: `<a></a>`. When this happens, the symbol is implicitly `to_s`-d so a new string is allocated. We can get around that by using a frozen string instead which This change buys us 74,236 bytes of memory and 1,855 fewer objects per request.
* Cut string ActionView template allocationsschneems2015-07-291-2/+7
| | | | | | The instrument method creates new strings, the most common action to instrument is "!render_template` so we can detect when that action is occurring and use a frozen string instead. This change buys us 113,714 bytes of memory and 1,790 fewer objects per request.
* Optimize hash keyschneems2015-07-291-1/+1
| | | | | | No idea why on earth this hash key isn't already optimized by MRI, but it isn't. :shit: This change buys us 74,077 bytes of memory and 1,852 fewer objects per request.
* Decrease string allocation in content_tag_stringschneems2015-07-291-6/+7
| | | | | | | | | | When an unknonwn key is passed to the hash in `PRE_CONTENT_STRINGS` it returns nil, when you call "#{nil}" it allocates a new empty string. We can get around this allocation by using a default value `Hash.new { "".freeze }`. We can avoid the `to_sym` call by pre-populating the hash with a symbol key in addition to a string key. We can freeze some strings when using Array#* to reduce allocations. Array#join can take frozen strings. This change buys us 86,600 bytes of memory and 1,857 fewer objects per request.
* Reduce hash allocations in route_setschneems2015-07-291-1/+1
| | | | | | | | When generating a url with `url_for` the hash of arguments passed in, is dup-d and merged a TON. I wish I could clean this up better, and might be able to do it in the future. This change removes one dup, since it's literally right after we just dup-d the hash to pass into this constructor. This may be a breaking, change but the tests pass...so :shipit: we can revert if it causes problems This change buys us 205,933 bytes of memory and 887 fewer objects per request.
* Decrease route_set allocationsschneems2015-07-291-3/+7
| | | | | | | | In handle_positional_args `Array#-=` is used which allocates a new array. Instead we can iterate through and delete elements, modifying the array in place. Also `Array#take` allocates a new array. We can build the same by iterating over the other element. This change buys us 106,470 bytes of memory and 2,663 fewer objects per request.
* Speed up journey missing_keysschneems2015-07-291-3/+15
| | | | | | | | Most routes have a `route.path.requirements[key]` of `/[-_.a-zA-Z0-9]+\/[-_.a-zA-Z0-9]+/` yet every time this method is called a new regex is generated on the fly with `/\A#{DEFAULT_INPUT}\Z/`. OBJECT ALLOCATIONS BLERG! This change uses a special module that implements `===` so it can be used in a case statement to pull out the default input. When this happens, we use a pre-generated regex. This change buys us 1,643,465 bytes of memory and 7,990 fewer objects per request.
* Speed up journey extract_parameterized_partsschneems2015-07-291-2/+3
| | | | | | | | Micro optimization: `reverse.drop_while` is slower than `reverse_each.drop_while`. This doesn't save any object allocations. Second, `keys_to_keep` is typically a very small array. The operation `parameterized_parts.keys - keys_to_keep` actually allocates two arrays. It is quicker (I benchmarked) to iterate over each and check inclusion in array manually. This change buys us 1774 fewer objects per request
* Decrease string allocations in url_optionsschneems2015-07-291-1/+5
| | | | | | The request.script_name is dup-d which allocates an extra string. It is most commonly an empty string "". We can save a ton of string allocations by checking first if the string is empty, if so we can use a frozen empty string instead of duplicating an empty string. This change buys us 35,714 bytes of memory and 893 fewer objects per request.
* Decrease string allocations in apply_inflectionsschneems2015-07-292-5/+36
| | | | | | In `apply_inflections` a string is down cased and some whitespace stripped in the front (which allocate strings). This would normally be fine, however `uncountables` is a fairly small array (10 elements out of the box) and this method gets called a TON. Instead we can keep an array of valid regexes for each uncountable so we don't have to allocate new strings. This change buys us 325,106 bytes of memory and 3,251 fewer objects per request.
* Decrease string allocations on AR#respond_to?schneems2015-07-291-1/+9
| | | | | | When a symbol is passed in, we call `to_s` on it which allocates a string. The two hardcoded symbols that are used internally are `:to_partial_path` and `:to_model`. This change buys us 71,136 bytes of memory and 1,777 fewer objects per request.
* Merge pull request #21065 from rails/schneems/fix-assets_testRichard Schneeman2015-07-292-0/+2
|\ | | | | Fix tests on master
| * Fix rake/notes_testschneems2015-07-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | Presumably due to https://github.com/rails/sprockets-rails/pull/265 sprockets was trying to load the "scss" gem but it isn't in the gemfile: ``` ApplicationTests::RakeTests::RakeNotesTest#test_register_a_new_extension: LoadError: cannot load such file -- sass ``` If we use an empty precompile list, it won't try to load sass.
| * Fix reported regression rails/sprockets-rails#265schneems2015-07-291-0/+1
|/ | | | We can prevent the UglifierCompressor from being instantiated prematurely by setting precompile to an empty array in this test.
* Merge pull request #21056 from yui-knk/fix/deprecation_silenceRafael Mendonça França2015-07-291-1/+4
|\ | | | | Make silence a warning inserted by commit #4b3f8ac
| * Make silence a warning inserted by commit #4b3f8acyui-knk2015-07-301-1/+4
| |
* | Merge pull request #21054 from yui-knk/fix/doc_field_error_procClaudio B.2015-07-291-1/+1
|\ \ | |/ |/| [ci skip] `field_error_proc` is used in `ActionView::Helpers::ActiveM…
| * [ci skip] `field_error_proc` is used in ↵yui-knk2015-07-291-1/+1
|/ | | | | | `ActionView::Helpers::ActiveModelInstanceTag` so replace `Active Record` with `Active Model`
* Merge pull request #21049 from y-yagi/fix_i18n_validation_testCarlos Antonio da Silva2015-07-281-1/+1
|\ | | | | pass the correct argument to mock on a test of `validates_length_of`
| * pass the correct argument to mock on a test of `validates_length_of`yuuji.yaginuma2015-07-281-1/+1
|/
* Tiny documentation edits [ci skip]Robin Dupret2015-07-283-6/+8
|
* Merge pull request #21048 from yui-knk/fix/guide_about_action_pack2Yves Senn2015-07-281-1/+1
|\ | | | | [ci skip] Add a link to action_controller_overview.html
| * [ci skip] Add a link to action_controller_overview.htmlyui-knk2015-07-281-1/+1
|/
* Merge pull request #21047 from yui-knk/fix/guide_about_action_packRobin Dupret2015-07-281-1/+1
|\ | | | | [ci skip] Now Action View is completely separated from Action Pack
| * [ci skip] Now Action View is completely separated from Action Packyui-knk2015-07-281-1/+1
|/
* Add `:nodoc:` for internal testing methods [ci skip]Robin Dupret2015-07-285-9/+9
|
* Merge pull request #20590 from vngrs/set_default_charsetRafael Mendonça França2015-07-272-6/+13
|\ | | | | Document, refactor and create test case for ActionDispatch::Response
| * Document, refactor and create test case for ↵Mehmet Emin İNAÇ2015-06-172-6/+13
| | | | | | | | ActionDispatch::Response#charset= method
* | Merge pull request #20849 from vngrs/misleading_nested_exceptionsRafael Mendonça França2015-07-275-8/+36
|\ \ | | | | | | Fix misleading errors for has_one through relations
| * | Fix misleading errors for has_one through relationsMehmet Emin İNAÇ2015-07-225-8/+36
| | |
* | | Merge pull request #20759 from vngrs/fix_wrong_docRafael Mendonça França2015-07-271-2/+2
|\ \ \ | | | | | | | | Change wrong usage in documentation about autoload_paths [ci skip]
| * | | Change wrong usage in documentation about autoload_paths [ci skip]Mehmet Emin İNAÇ2015-07-021-2/+2
| | | | | | | | | | | | | | | | We can't use this configuration outside of the application.rb
* | | | Merge pull request #21031 from vngrs/fix_params_wrapper_docRafael Mendonça França2015-07-271-3/+3
|\ \ \ \ | | | | | | | | | | Fix params_wrapper doc [ci skip]
| * | | | Fix params_wrapper doc [ci skip]Mehmet Emin İNAÇ2015-07-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This feature also works with `PUT`, `PATCH` and `DELETE` requests. Also developers can add `:url_encoded_form` and `:multipart_form` into the `:format` for wrapping url encoded or multipart form data.
* | | | | Merge pull request #20904 from kaspth/wildcard-template-dependenciesKasper Timm Hansen2015-07-279-12/+121
|\ \ \ \ \ | | | | | | | | | | | | Add wildcard template dependencies.
| * | | | | Add wildcard template dependencies.Kasper Timm Hansen2015-07-269-12/+121
| | | | | |
* | | | | | Merge pull request #21040 from aditya-kapoor/fix-typoArthur Nogueira Neves2015-07-271-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | [ci skip] it should be protect_from_forgery
| * | | | | | [ci skip] it should be protect_from_forgeryAditya Kapoor2015-07-271-1/+1
| | | | | | |
* | | | | | | Merge pull request #21003 from robin850/api-pluginsRafael Mendonça França2015-07-275-9/+84
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Allow generating plugins for API applications
| * | | | | | | Enable the `api_only` option for API plugins' generatorsRobin Dupret2015-07-232-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This way, running a generator inside the plugin's directory, files that are not relevant won't be generated (e.g. views or assets). This won't interfere with the application's generators configuration.
| * | | | | | | Generate an API dummy application for API pluginsRobin Dupret2015-07-232-0/+9
| | | | | | | |
| * | | | | | | Make ApplicationController inherit from AC::API for API pluginsRobin Dupret2015-07-232-1/+9
| | | | | | | |
| * | | | | | | Skip assets, helpers and views generation for API pluginsRobin Dupret2015-07-232-8/+27
| | | | | | | |
| * | | | | | | Add the `--api` option for the plugin generatorRobin Dupret2015-07-232-0/+12
| | | | | | | |
* | | | | | | | Merge pull request #21035 from radar/ryan-bigg-has-changed-jobsGodfrey Chan2015-07-261-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Ryan Bigg has changed jobs
| * | | | | | | | Ryan Bigg has changed jobs.Ryan Bigg2015-07-271-1/+1
| | | | | | | | |
* | | | | | | | | Merge pull request #21030 from yahonda/mysql2_20969Kasper Timm Hansen2015-07-261-2/+2
|\ \ \ \ \ \ \ \ \ | |_|_|_|_|/ / / / |/| | | | | | | | Remove @connection instance variable only when defined
| * | | | | | | | Remove @connection instance variable only when definedYasuo Honda2015-07-261-2/+2
|/ / / / / / / /
* | | | | | | | Properly allow uniqueness validations on primary keys.Sean Griffin2015-07-253-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an alternate implementation of #20966. [Sean Griffin & presskey]
* | | | | | | | Merge pull request #21007 from clayton-shopify/fix-mailto-encodingRafael Mendonça França2015-07-242-1/+9
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Encode the email address as prescribed in RFC 6068 section 2.