Skip to content

Memoize calls to can_view_solutions? inside representers#185

Merged
Dantemss merged 1 commit intomasterfrom
fewer-can-view-solutions-calls
Mar 14, 2017
Merged

Memoize calls to can_view_solutions? inside representers#185
Dantemss merged 1 commit intomasterfrom
fewer-can-view-solutions-calls

Conversation

@jpslav
Copy link
Member

@jpslav jpslav commented Mar 14, 2017

can_view_solutions? is called a lot (on the same exercise with the same user) when rendering an exercise to JSON. This PR memoizes its value. In a production example, the method was being called 12 times; this reduces it to once.

@Dantemss Dantemss merged commit 8c61f2e into master Mar 14, 2017
@Dantemss Dantemss deleted the fewer-can-view-solutions-calls branch March 14, 2017 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants