aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #22348 from kv109/22233_without_deprecationAndrew White2015-11-241-1/+2
|\ | | | | Fix wrong timezone mapping for Switzerland (no deprecation warn) [22233]
| * Fix wrong timezone mapping for Switzerland [22233]Kacper Walanus2015-11-151-1/+2
| |
* | Test if each_object(singleton_class) works, since JRuby added it.Charles Oliver Nutter2015-11-231-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #22376. JRuby 9.0.5.0 will support ObjectSpace.each_object against a class's singleton class, since that's essentially just walking an internal subclasses structure we already maintain. This test was too narrow, requiring that each_object support an arbitrary class but only actually needing it to work against a class's singleton. This improves performance of Class.descendants by nearly two orders of magnitude when run against JRuby 9.0.5.0: ```ruby 5.times { puts Benchmark.measure { 100_000.times { Numeric.descendants } } } ``` Before: ``` 11.510000 0.140000 11.650000 ( 10.082384) 9.990000 0.020000 10.010000 ( 9.931233) 10.520000 0.040000 10.560000 ( 10.502978) 10.290000 0.030000 10.320000 ( 10.276027) 10.000000 0.030000 10.030000 ( 9.942429) ``` After: ``` 1.380000 0.040000 1.420000 ( 0.365850) 0.210000 0.000000 0.210000 ( 0.149574) 0.180000 0.020000 0.200000 ( 0.141094) 0.140000 0.000000 0.140000 ( 0.140634) 0.190000 0.010000 0.200000 ( 0.147962) ```
* | removes the mutex around `changed`Xavier Noria2015-11-221-7/+2
| | | | | | | | | | | | | | | | | | | | | | This method needs to ensure that if a change happens, it is going to be registered. With this refactor suggested by @matthewd race conditions do not matter because if no file is watched, nothing is done. And as long as some invocation sets the flag to true, it will stay true. The refactor leaves a race condition in which two simultaneous threads that watch some of the files passed do the actual work in `any?`, whereas the mutex guaranteed that was done at most once. But this is considered to be a better tradeoff.
* | reset the @updated flag before the callback invocationXavier Noria2015-11-211-2/+1
| |
* | make the @updated flag atomic in the evented monitorXavier Noria2015-11-211-5/+11
| | | | | | | | listen is calling us from its own thread, we need to synchronize reads and writes to this flag.
* | Merge pull request #22332 from grosser/grosser/deprecationRafael França2015-11-204-4/+36
|\ \ | | | | | | add deprecations for a smooth transition after #22215
| * | add deprecations for a smooth transition after #22215Michael Grosser2015-11-194-4/+36
| | |
* | | Merge pull request #22336 from tjschuck/enumerable_sum_perfKasper Timm Hansen2015-11-191-1/+1
|\ \ \ | | | | | | | | Change Enumerable#sum to use inject(:sym) specification
| * | | Change Enumerable#sum to use inject(:sym) specificationT.J. Schuck2015-11-191-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not only does this make for simpler, more obvious code, it's also more performant: require 'benchmark/ips' module Enumerable def old_sum(identity = 0, &block) if block_given? map(&block).old_sum(identity) else inject { |sum, element| sum + element } || identity end end def new_sum(identity = 0, &block) if block_given? map(&block).new_sum(identity) else inject(:+) || identity end end end summable = (1..100).to_a # sum is 5050 Benchmark.ips do |x| x.report("old_sum") { summable.old_sum } x.report("new_sum") { summable.new_sum } x.compare! end # Calculating ------------------------------------- # old_sum 10.674k i/100ms # new_sum 14.542k i/100ms # ------------------------------------------------- # old_sum 117.350k (± 7.1%) i/s - 587.070k # new_sum 154.712k (± 3.8%) i/s - 785.268k # # Comparison: # new_sum: 154712.1 i/s # old_sum: 117350.0 i/s - 1.32x slower More benchmarks [here](https://gist.github.com/tjschuck/b3fe4e8c812712376648), including summing strings and passing blocks. The performance gains are less for those, but this version still always wins.
* / / Add missing requireMatthew Draper2015-11-191-0/+2
|/ / | | | | | | Fixes #22311
* | Merge pull request #22215 from grosser/grosser/normalize_keyRafael França2015-11-164-34/+34
|\ \ | |/ |/| send normalized keys to the cache backends so they do not need to man…
| * keep deprecated namespaced_key in case any subclass uses itMichael Grosser2015-11-103-2/+3
| |
| * send normalized keys to the cache backends so they do not need to manage ↵Michael Grosser2015-11-104-33/+32
| | | | | | | | this themselves
| * Merge pull request #22216 from grosser/grosser/fast-retRafael França2015-11-101-9/+12
| |\ | | | | | | fast and consistent return when local_cache does not exist
| | * fast and consistent return when local_cache does not existMichael Grosser2015-11-071-9/+12
| | |
| * | Merge pull request #22244 from pacso/time-days-in-yearAndrew White2015-11-101-0/+6
| |\ \ | | | | | | | | Add days_in_year method to Time class
| | * | Add days_in_year methodJon Pascoe2015-11-101-0/+6
| | | |
| * | | Minor fix in Module#mattr_reader documentationYuri Kasperovich2015-11-091-1/+1
| |/ /
* | | base (refined) Pathname#ascendant_of? also on Pathname#ascendXavier Noria2015-11-121-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | A small rewrite in a last attempt at writing obvious and portable code without manual string manipulation. Note that Pathname#== uses string comparison on Windows, so if client code passes "C:\foo" and "c:/foo/bar" the predicate won't see the former is an ascendant of the latter. Risky business.
* | | Use the file watcher defined by the app configDharam Gollapudi2015-11-111-1/+1
| | | | | | | | | This can make use of the FileEventedUpdateChecker, if available.
* | | let filter_out_descendants do less passesXavier Noria2015-11-111-9/+9
| | | | | | | | | | | | | | | | | | Whatever the inner loop selects, we already know is a descendant and can be filtered out right away from dirs_sorted_by_nparts to skip useless iterations.
* | | revises the implementation of Pathname#ascendant_of? (in refinement)Xavier Noria2015-11-111-1/+8
| | |
* | | update docs for MessageEncryptor#new to recommend a KDF [ci skip]Paul Kehrer2015-11-111-2/+2
| | |
* | | Add days_in_year methodJon Pascoe2015-11-111-0/+6
| | |
* | | Minor fix in Module#mattr_reader documentationYuri Kasperovich2015-11-111-1/+1
| | |
* | | fast and consistent return when local_cache does not existMichael Grosser2015-11-111-9/+12
| | |
* | | applies code style guidelinesXavier Noria2015-11-112-7/+7
| | |
* | | simplifies the implementation of #watching?Xavier Noria2015-11-111-16/+12
| | |
* | | simplifies directories_to_watchXavier Noria2015-11-111-7/+4
| | |
* | | adds a comment about how does filter_out_descendants preserve orderXavier Noria2015-11-111-0/+1
| | |
* | | rewrites bare loop as untilXavier Noria2015-11-111-3/+1
| | |
* | | simplifies the implementation of existing parentXavier Noria2015-11-101-13/+2
| | |
* | | indents private methods as per our guidelinesXavier Noria2015-11-101-28/+28
| | |
* | | simplifies PathHelper with a Pathname refinementXavier Noria2015-11-101-22/+22
| | |
* | | the evented monitor filters out descendantsXavier Noria2015-11-101-10/+36
| | |
* | | s/@modified/@updated/gXavier Noria2015-11-081-6/+6
| | |
* | | stop ascending at the longest common subpathXavier Noria2015-11-081-33/+66
| | | | | | | | | | | | This commit also bases everything on Pathname internally.
* | | remove explicit File.expand_path callXavier Noria2015-11-081-1/+1
| | |
* | | no need to have access to the listenerXavier Noria2015-11-081-4/+1
| | |
* | | revises the implementation of the evented file monitorXavier Noria2015-11-081-24/+65
| | |
* | | implements an evented file update checker [Puneet Agarwal]Xavier Noria2015-11-081-0/+67
|/ / | | | | | | | | | | | | | | | | | | | | | | This is the implementation of the file update checker written by Puneet Agarwal for GSoC 2015 (except for the tiny version of the listen gem, which was 3.0.2 in the original patch). Puneet's branch became too out of sync with upstream. This is the final work in one single clean commit. Credit goes in the first line using a convention understood by the contrib app.
* | Merge pull request #22206 from grosser/grosser/drySantiago Pastorino2015-11-081-20/+15
|\ \ | | | | | | dry up increment/decrement
| * | dry up increment/decrementMichael Grosser2015-11-071-20/+15
| | |
* | | Merge pull request #21897 from swaathi/masterKasper Timm Hansen2015-11-072-10/+43
|\ \ \ | |_|/ |/| | Parameterize with options to preserve the case of string
| * | Parameterize with options to preserve case of stringSwaathi K2015-11-072-10/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added test cases Using kwargs instead of three seperate functions Updated parameterize in transliterate.rb Updated parameterize in transliterate.rb Added deprecation warnings and updating RDoc+Guide Misspelled separtor. Fixed. Deprecated test cases and added support to parameterize with keyword parameters Squashing commits. Fixed test cases and added deprecated test cases Small changes to Gemfile.lock and CHANGELOG Update Gemfile.lock
* | | Merge pull request #22197 from grosser/grosser/fetchKasper Timm Hansen2015-11-071-9/+5
|\ \ \ | |_|/ |/| | do not override fetch on local cache
| * | do not override fetch on local cacheMichael Grosser2015-11-071-9/+5
| |/ | | | | | | | | | | fetch is supposed to behave differently, this was a mistake merged in https://github.com/rails/rails/pull/22194
* | Merge pull request #21806 from kachick/fix-transformer-sizeEileen M. Uchitelle2015-11-072-4/+4
|\ \ | |/ |/| Return a sized Enumerator from Hash#transform_values{!}
| * Return a sized Enumerator from Hash#{transform_values{!}|transform_keys{!}}Kenichi Kamiya2015-09-292-4/+4
| |