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

Add ParseResponseBody option to fix severe frame rate drop when parsing large response #92

Open
wants to merge 1 commit into
base: master
from

Conversation

@TigerHix
Copy link

commented Aug 8, 2019

The following code easily freezes the editor once the download is completed:

RestClient.Get(new RequestHelper {
    Uri = "https://github.com/pytorch/pytorch/archive/v1.1.0.zip"
});

image

The reason is that RestClient uses UnityWebRequest.Text in HttpBase several times for parsing as JSON and logging debug info. However, this has severe performance impact if the downloaded data is very large and non-text:

image

This PR adds a new option, ParseResponseBody, to RequestHelper. This option is by default true, but will be automatically set to false when RequestHelper.DownloadHandler is set to any instance of DownloadHandlerFile, DownloadHandlerTexture, DownloadHandlerAssetBundle, DownloadHandlerAudioClip - if the user specifies those as the download handler, they probably don't want to encode the downloaded data and parse it as JSON.

The above spike disappears with this change when testing on Unity 2019.1.10f1. Any feedback will be appreciated!

@TigerHix

This comment has been minimized.

Copy link
Author

commented Aug 14, 2019

@jdnichollsc

This comment has been minimized.

Copy link
Member

commented Aug 14, 2019

Oh sorry, let me check at night, thanks!

@TigerHix

This comment has been minimized.

Copy link
Author

commented Aug 21, 2019

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.