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

Memoize RecordedInteraction conversion #83

Merged
merged 3 commits into from
Oct 5, 2018

Conversation

ronocod
Copy link
Contributor

@ronocod ronocod commented Oct 5, 2018

toImmutable() is called very frequently from MemoryTape, especially from findMatch which loops through each interaction. findMatch is a synchronized method too so when multiple requests are in flight only one can enter findMatch at a time.

As this method returns only value per YamlRecordedInteraction instance, memoizing can speed things up a lot. In cases where our app make multiple requests simultaneously, it's causing some responses to return in 10ms where they were taking over 200ms before.

Copy link
Collaborator

@felipecsl felipecsl left a comment

Choose a reason for hiding this comment

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

nice, this is great!

@felipecsl felipecsl merged commit c926568 into airbnb:master Oct 5, 2018
@ronocod ronocod deleted the memoize-immutable branch October 5, 2018 14:24
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