Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With context and better sharing for memoization #310

Merged
merged 4 commits into from
Jul 1, 2016

Conversation

Nathan-Fenner
Copy link
Contributor

@Nathan-Fenner Nathan-Fenner commented Jun 30, 2016

Add a WithAdditionalConstraint(predicate.Predicate) method to EvaluationContext that plays nice with memoization.

Also, add a memoizationMap to the EvaluationContext which can be used to look up already-existing memoizations within the same query, which makes the following query much more efficient, by performing the fetch for cpu only once instead of twice:

transform.timeshift(cpu, -1w) + transform.timeshift(cpu, -1)
from -30m to now

@drcapulet drcapulet self-assigned this Jul 1, 2016
m.Lock()
defer m.Unlock()
_, ok := m.Map[i]
if !ok {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can just do if _, ok := m.Map[i]; !ok {

@drcapulet drcapulet merged commit 0ecffaa into master Jul 1, 2016
@drcapulet drcapulet deleted the nathan-fenner-with-context branch July 1, 2016 23:58
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