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

IC/TS: Plug a hole that led to redundant tile reads #2557

Merged
merged 1 commit into from
Apr 21, 2020

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented Apr 14, 2020

I was investigating thread behavior while fixing a totally unrelated
bug, and I spotted a way that redundant I/O happens when the same tile
is needed by multiple threads at once. (And it really did happen, I
could see the extra reads in the stats.)

A small additional method to unordered_map_current allows us to
simplify the logic in add_tile_to_cache fully avoid the redundant
read.

Testing against our production benchmarks, this makes no measurable
difference to performance, even under heavy threading. I think that's
because we make sure that all our texture files are prepared with
'maketx', and thus are tiled, so even the presence of a few redundant
tile reads is essentially undetectable in a full render. However, for
somebody who is using untiled textures (such as jpegs), which will be
read as whole images, this might be a bigger performance gain because
those redundant reads are redundant reads of the entire file.

I was investigating thread behavior while fixing a totally unrelated
bug, and I spotted a way that redundant I/O happens when the same tile
is needed by multiple threads at once. (And it really did happen, I
could see the extra reads in the stats.)

A small additional method to `unordered_map_current` allows us to
simplify the logic in `add_tile_to_cache` fully avoid the redundant
read.

Testing against our production benchmarks, this makes no measurable
difference to performance, even under heavy threading. I think that's
because we make sure that all our texture files are prepared with
'maketx', and thus are tiled, so even the presence of a few redundant
tile reads is essentially undetectable in a full render. However, for
somebody who is using untiled textures (such as jpegs), which will be
read as whole images, this might be a bigger performance gain because
those redundant reads are redundant reads of the entire file.
@lgritz lgritz merged commit 657f396 into AcademySoftwareFoundation:master Apr 21, 2020
@lgritz lgritz deleted the lg-redundantread branch April 21, 2020 19:02
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.

None yet

1 participant