| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|\ \ \
| | | |
| | | | |
add deprecations for a smooth transition after #22215
|
| | |/
| |/| |
|
|\ \ \
| | | |
| | | | |
Change Enumerable#sum to use inject(:sym) specification
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
|/ /
| |
| |
| | |
Fixes #22311
|
|\ \
| |/
|/| |
send normalized keys to the cache backends so they do not need to man…
|
| | |
|
| |
| |
| |
| | |
this themselves
|
| |\
| | |
| | | |
fast and consistent return when local_cache does not exist
|
| | | |
|
| |\ \
| | | |
| | | | |
Add days_in_year method to Time class
|
| | | | |
|
| |/ / |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | | |
This can make use of the FileEventedUpdateChecker, if available.
|
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | | |
This commit also bases everything on Pathname internally.
|
| | | |
|
| | | |
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| | |
| | | |
dry up increment/decrement
|
| | | |
|
|\ \ \
| |_|/
|/| | |
Parameterize with options to preserve the case of string
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
|\ \ \
| |_|/
|/| | |
do not override fetch on local cache
|
| |/
| |
| |
| |
| |
| | |
fetch is supposed to behave differently, this was a mistake merged in
https://github.com/rails/rails/pull/22194
|
|\ \
| |/
|/| |
Return a sized Enumerator from Hash#transform_values{!}
|
| | |
|
|\ \
| | |
| | | |
call local_cache 1 time instead of 3 times
|
| | |
| | |
| | |
| | |
| | | |
LocalCache read_entry previously called the local_cache method 3 times,
now it only calls it once and keeps the result in a local variable.
|
|/ /
| |
| |
| |
| | |
extending an instance with a module puts the methods on top of it,
prepend does the same but on the class level, so less work for us and more standard way of doing things
|
|\ \
| | |
| | | |
cache nil replies from backend cache so misses are fast too
|
| | | |
|
| | | |
|