| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Removing this feature causes boost in performance when using Ruby 1.9.
Ruby 1.9 started to do implicit conversions using `to_ary` and `to_str`
in some STDLIB methods (like Array#join). To do such implicit conversions,
Ruby 1.9 always dispatches the method and rescues the NoMethodError exception
in case one is raised.
Therefore, since the whiners feature defined NilClass#method_missing, such
implicit conversions for nil became much, much slower. In fact, just defining
NilClass#method_missing (even without the whiners feature) already causes a
massive slow down. Here is a snippet that shows such slow down:
require "benchmark"
Benchmark.realtime { 1_000.times { [nil,nil,nil].join } }
class NilClass
def method_missing(*args)
raise NoMethodError
end
end
Benchmark.realtime { 1_000.times { [nil,nil,nil].join } }
|
| |
|
| |
|
| |
|
|
|
|
| |
new one
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
At New Relic, we have hundreds of thousands of tables, and our migrations took 30 minutes without this similar patch. This cuts it down to a more reasonable amount of time.
The rescue false part is ugly, but necessary as far as I can tell. I don't know of a cross-database statement you can make that will work without trapping errors.
|
|\
| |
| | |
Do not validate associated records marked for destruction
|
| |
| |
| |
| |
| |
| | |
The main reason for this change is to fix a bug where
`validates_associated` would prevent `accepts_nested_attributes_for`
with `allow_destroy: true` from destroying invalid associated records.
|
|\ \
| |/
|/| |
Fix sequence name with abstract classes.
|
| | |
|
| | |
|
| | |
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit vastly reduces the impact of auto
explain logging when enabled, while keeping
a negligible cost when disabled.
The first implementation was based on the idea
of subscribing to "sql.active_record" when
needed, and unsubscribing once done. This is
the idea behind AR::Relation#explain. Subscribe,
collect, unsubscribe.
But with the current implementation of notifications
unsubscribing is costly, because it wipes an internal
cache and that puts a penalty on the next event.
So we are switching to an approach where a long-running
subscriber is listening. Instead of collecting the
queries with a closure in a dedicated subscriber, now
we setup a thread local.
If the feature is disabled by setting the threshold
to nil, the subscriber will call a method that does
nothing. That's totally cheap.
|
|/ |
|
| |
|
|
|
|
|
| |
We also need to time zone convert time zone aware attributes when
accessed via read_attribute, not only when via direct access.
|
|
|
|
|
|
|
| |
Rationale: As discussed with José and Jon, this convenience
shortcut is not clearly justified and it could let the user
thing the disabled EXPLAINs are related to the model instance
rather than being globally disabled.
|
|\
| |
| | |
reintroduce patch from #726 to handle nested eager loading via associations
|
| | |
|
|\ \
| | |
| | | |
Use show create table (fix 3678: third time).
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
|/ / |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit f6b5046305d43c5f64bcb6fed0e44f7bca99a603.
Fear not, the roflscale will return when I have a bit more time and
figure out a better way to do it. (In particular, a way that doesn't
break the build.)
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
Don't prefix the name with attribute_. Avoids a string allocation on
read_attribute, which is a bit faster.
|
| |
| |
| |
| |
| |
| |
| |
| | |
This means we never have to rely on define_method (which is slower and
uses more memory), even when we have attributes containing characters
that are not allowed in standard method names.
(I am mainly changing this because the duplication annoys me, though.)
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Also make it actually work.
It slows down all read_attribute accesses to map 'id' to whatever the PK
actually is, inside read_attribute. So instead make sure the necessary
methods are defined and that they redirect wherever they need to go.
|
| |
| |
| |
| | |
This is good because it reduces duplication.
|
| |
| |
| |
| | |
This makes me happy!
|
| |
| |
| |
| |
| |
| | |
Define singleton methods on the attributes module instead. This reduces
method pollution on the actual model classes. It also seems to make
something faster, I am unsure why! O_o
|
| | |
|
| | |
|
| |
| |
| |
| | |
changes to attribute serialization.
|
| | |
|
| | |
|
| |
| |
| |
| | |
to a different type
|
| |
| |
| |
| |
| |
| |
| | |
Implement a mini state machine for serialized attributes. This means we
do not have to deserialize the values upon initialization, which means
that if we never actually access the attribute, we never have to
deserialize it.
|