mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-08 05:30:39 +00:00
Improve territory drawing performances (#696)
## Description: Territory drawing are computing the same information for each pixel drawn. A few fixes can noticably improve the performances: ### Caching colors some colors are computed each time they are retrieved, and according to the profiler the border color is the most expensive to compute each frame:  This PR adds a cache for this color. The other colors have almost no impact on performance, so there's no need to cache them. After caching:  ### Retrieving player info Drawing the player territory leads to unecessary and expensive data gathering, such as the anonymous name list:  Instead, after retrieving the proper data directly:  ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Please put your Discord username so you can be contacted if a bug or regression is found: IngloriousTom
This commit is contained in:
@@ -182,12 +182,12 @@ export class PlayerView {
|
||||
return this.data.flag;
|
||||
}
|
||||
name(): string {
|
||||
return userSettings.anonymousNames() && this.anonymousName !== null
|
||||
return this.anonymousName !== null && userSettings.anonymousNames()
|
||||
? this.anonymousName
|
||||
: this.data.name;
|
||||
}
|
||||
displayName(): string {
|
||||
return userSettings.anonymousNames() && this.anonymousName !== null
|
||||
return this.anonymousName !== null && userSettings.anonymousNames()
|
||||
? this.anonymousName
|
||||
: this.data.name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user