Fix async image load#2006
Conversation
…e subsequent image loading operations can safely use synchronous IO
…ons after preloading the stream, rather than async actions (since the async actions all ultimately operate synchronously anyway)
|
Everything looks good so far from an implementation perspective. We'll need to figure out a strategy now to compare the new Async performance with Main. |
|
@antonfirsov I just pushed a change to Allocation blocks match this scale. Once the total allocation within the stream hits our threshold we immediately switch to allocating larger chunk sizes. I chose the the the values for the following reasons
I'm not precious about any of these values to if you feel like they should change then please suggest alternatives. |
JimBobSquarePants
left a comment
There was a problem hiding this comment.
I'm approving this but want a second opinion before merging.
|
I want to take a look next week. Quite distracted from everything programming-related thanks to the ongoing Fourth Reich experiment on my continent, right in the neighborhood. |
|
Of course mate. Absolute horror show over there! |
|
@kroymann can you please give me permission to push to your branch? (Thought it is always allowed for contributors for PR branches.) As an alternative, feel free to cherry pick it. |
Prerequisites
Description
This addresses the issue outlined in #1997 where
Image.LoadAsync(stream)would incorrectly use synchronous IO if the stream is seekable. The fix is simply to remove the optimization that avoids prebuffering the stream into an in-memory buffer if the stream is seekable, and instead always prebuffer the stream. This ensures that async IO is always used to read the stream.