Skip to content

Cache isEmpty separately from size in DenseLocalDateDoubleTimeSeries#2166

Merged
jodastephen merged 5 commits into
masterfrom
topic/cache-is-empty
May 29, 2020
Merged

Cache isEmpty separately from size in DenseLocalDateDoubleTimeSeries#2166
jodastephen merged 5 commits into
masterfrom
topic/cache-is-empty

Conversation

@wjnicholson
Copy link
Copy Markdown
Contributor

Realised my previous PR would add a lot of computation in the case that we rarely access a time series

@wjnicholson wjnicholson requested a review from jodastephen May 29, 2020 12:08
if (e == 0) {
// take cached size if already calculated
int s = size;
boolean any = s != 0 ? s > 1 : validIndices().findAny().isPresent();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect if you are worried about performance, looping over the double[] and calling isValidPoint would be quicker than the more weighty stream system. Also, I'd expect that size() and the constructors should set isEmpty.

@wjnicholson wjnicholson requested a review from jodastephen May 29, 2020 15:26
@jodastephen jodastephen merged commit 2a3020c into master May 29, 2020
@delete-merged-branch delete-merged-branch Bot deleted the topic/cache-is-empty branch May 29, 2020 15:37
@jodastephen jodastephen added this to the v2.8 milestone Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants