You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a better equivalence test for incremental "buffer" methods for EMA.
Static series are still the most performant overall.
The "Inc" methods are only faster than the original because we're not sorting the input, but are equivalently 4× slower, likely due to re-writes from the RemoveAt(0) buffer management.
Method
Mean
Ratio
Notes
IncRus
7.35us
2.60
Incrementing with IReusable input value, one at a time.
IncRusBatch
7.27us
2.58
Incrementing with IReusable batch.
IncQot
7.42us
2.63
Incrementing with IQuote input value, one at a time.
IncQotBatch
7.29us
2.58
Incrementing with IQuote batch.
IncPrm
5.15us
1.83
Incrementing with primitive double, one at a time.
IncPrmBatch
5.27us
1.87
Incrementing with primitive double batch.
SeriesEqiv
2.82us
1.00
Original series without sorting (benchmark).
SeriesOrig
8.57us
3.04
Original series with sorting.
IncremEqiv
13.06us
4.63
Incrementing with Quote batch and sorting, for a same-same comparison.
StreamEqiv
27.32us
9.67
Stream hub. It has more self-healing and analysis features (more overhead).
Still need to fix/try out a few scenarios:
Add argument null checks
Try Add overload syntax again; this was conflicting with base List.Add(double?).
Try rename class to "Ema" again, there were some conflicts with utilities.
Add buffer to original series, just for a sanity check
Explore alternatives to RemoveAt(0) for incrementing buffer.
Consider removing primitive variant since it's an old model, like TA-LIB, that just offloads work to the user. Or, defer to the backlog.
Also, given the 3× improvement without sorting:
Consider offloading sorting responsibility for time-series methods to the user. I suspect most batch quote providers will or can be fetched in a correct sort anyway.
Related: consider using IReadOnlyList<IQuote> quotes as input, instead of IEnumerable<IQuote> quotes
Update documentation accordingly
Expand Validate() to have generic overload (related)?
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Side piece of
feat: Full chain streaming prototypes #1092
See inline to dos and deferrals to log