-
Notifications
You must be signed in to change notification settings - Fork 1.2k
6.x Performance Improvements #3279
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
Merged
Merged
Conversation
This file contains hidden or 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
Mpdreamz
approved these changes
Jun 11, 2018
Member
Mpdreamz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So much goodness in here 👍 will rebase against 6.x now
| var anyEmpty = combined.Any(q => q == null || !q.IsWritable); | ||
| query = anyEmpty ? combined.FirstOrDefault(q => q != null && q.IsWritable) : null; | ||
| return anyEmpty; | ||
| query = null; |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This commit removes the need to copy the response bytes into a MemoryStream to get the bytes and check the length, by simply checking the length of the stream directly.
This commit removes string allocations when creating a Stream from a JToken, by writing the token directly to a stream using UTF-8 encoding
…lizer This commit removes the JToken to Stream handoff within SourceConverter when the SourceSerializer is InternalSerializer, by passing the JsonReader directly.
…solver This commit reverts the previous check added in SourceConverter to determine whether it's the InternalSerializer by fixing a bug in ElasticContractResolver that is intended to perform this check. The bug is that the check is evaluated too early, before serializers have been assigned to ConnectionSettings. Now, the check is lazily made.
This commit adds a RecyclableMemoryStreamFactory that can pool underlying byte buffers for MemoryStreams for better reuse and fewer allocations. Add Create(byte[]) method on IMemoryStreamFactory to allow creation of a stream with written bytes. Include IMemoryStreamFactory on IConnectionConfigurationValues to allow it to be accessed inside custom JsonConverters.
2729bfc to
c987da9
Compare
Member
|
No more |
…gus deadlock that were popping up on my machine
Mpdreamz
pushed a commit
that referenced
this pull request
Jun 11, 2018
* Remove allocations in QueryBase IfEitherIsEmptyReturnTheOtherOrEmpty * Remove need to ReadBytesAsync This commit removes the need to copy the response bytes into a MemoryStream to get the bytes and check the length, by simply checking the length of the stream directly. * Honour SkipOnTeamCityAttribute for unit tests * Use EmptyReadOnly collection * Fix spelling and add xml documentation * Don't unneccessarily split string * Reduce string allocations when creating streams from JToken This commit removes string allocations when creating a Stream from a JToken, by writing the token directly to a stream using UTF-8 encoding * Add link to JSON.Net issue to extension method * Add benchmarks including JsonNetSerializer * Avoid JToken to Stream handoff when SourceSerializer is InternalSerializer This commit removes the JToken to Stream handoff within SourceConverter when the SourceSerializer is InternalSerializer, by passing the JsonReader directly. * Replace InternalSerializer check with lazy check in ElasticContractResolver This commit reverts the previous check added in SourceConverter to determine whether it's the InternalSerializer by fixing a bug in ElasticContractResolver that is intended to perform this check. The bug is that the check is evaluated too early, before serializers have been assigned to ConnectionSettings. Now, the check is lazily made. * small tidy-up * Add RecyclableMemoryStreamFactory This commit adds a RecyclableMemoryStreamFactory that can pool underlying byte buffers for MemoryStreams for better reuse and fewer allocations. Add Create(byte[]) method on IMemoryStreamFactory to allow creation of a stream with written bytes. Include IMemoryStreamFactory on IConnectionConfigurationValues to allow it to be accessed inside custom JsonConverters. * SkipOnTeamCity no longer has a description argument, small fix for Bogus deadlock that were popping up on my machine Conflicts: src/Tests/Framework/TestClient.cs
Member
|
merged and ported to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR introduces some performance improvements to 6.x
Streamfrom aJTokenby writing token to stream directlySourceConverterRecyclableMemoryStreamFactoryto pool byte buffers for streamsBenchmarkDotNet results
Comparing 5.6.2, 6.1.0 and 6.x (this branch).
Note that these use
InMemoryConnectionto return a fixed set of bytes.Search returning 100 documents
Search returning 1000 documents
Search returning 10000 documents