-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Optimize moshi decoding #2183
Optimize moshi decoding #2183
Conversation
WalkthroughThe proposed changes streamline the Moshi decoder in Feign by eliminating unused imports and simplifying JSON parsing. The modifications enhance performance and readability, making the code more efficient and maintainable. Changes
TipsChat with CodeRabbit Bot (
|
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.
Review Status
Actionable comments generated: 0
Files selected for processing (1)
- moshi/src/main/java/feign/moshi/MoshiDecoder.java (3 hunks)
Files skipped from review due to trivial changes (1)
- moshi/src/main/java/feign/moshi/MoshiDecoder.java
@@ -13,19 +13,16 @@ | |||
*/ | |||
package feign.moshi; | |||
|
|||
import com.google.common.io.CharStreams; |
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.
Can you also remove the guava dependency from pom?
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.
Good point, done in f3cd4d8
* perf: avoid writing full body to an intermediate string * fix: eagerly return null for empty bodies * chore(moshi): remove guava dependency --------- Co-authored-by: Marvin Froeder <[email protected]>
* perf: avoid writing full body to an intermediate string * fix: eagerly return null for empty bodies * chore(moshi): remove guava dependency --------- Co-authored-by: Marvin Froeder <[email protected]>
Follow-up to #2182
Summary by CodeRabbit
MoshiDecoder
in the Moshi library. The changes include removing unused imports, replacing theReader
withBufferedSource
from Okio for improved performance, and directly parsing JSON usingjsonAdapter.fromJson()
. This refactor enhances the efficiency of the decoding process and simplifies the underlying code structure.