yui/yui3 — pull request #626 by sdesai (2013-04-17 07:46:15+00:00)
Title: Minimal flux fix for CandleStickSeries regression from Attribute perf changes

This is a pull request to fix a last minute regression found with the attribute performance changes.

I still need to measure performance impact. It should just be an extra "in" in cases where attribute configs don't have a default value - so we should still maintain benefits for the 80% case. I'll update with numbers.

BACKGROUND

Prior to the Attribute perf changes, we used `state.addAll()` to set up
the initial config for an attribute while adding it. For performance
reasons this was replaced by simply setting `state.data` directly, to
consciously avoid iteration and mix costs for the initial add.

However there are use cases, such as CandleStickSeries' relationship
between it's `graphic` and `upcandle` attributes where this causes
a regression.

`graphic` is defined by a superclass, but it's setter is overridden by
CandleStickSeries. The overridden setter sets the `upcandle` attribute,
which only exists on CandleStickSeries, not on the superclass.

As a result, the value of `upcandle` is set while the `graphic` setter
is executed, before the `upcandle` attribute is formally added.

In older versions, we'd add the `upcandle` attribute later, when
processing CandleStickSeries attributes, and since we just merged,
we'd maintain the original set value. In the new version, since we
set `state.data` directly, the original value gets blown away.

FIX

The localized fix, aims to re-introduce the 'merge' behavior, if
a value already exists, while still trying to keep the optimized
performance.

The longer term fix, which is targetted for the next release is
to remove the class-by-class attribute setup and just added all
attributes in one shot, which not only avoids the issue, but will also likely result in more performance benefits.

TESTING

All library tests pass through yogi --no-cli. A unit test was added
to attribute for this use case.

Total]: Passed: 10843 Failed: 0 Total: 10936 (ignored 93)