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

Codechange: Sort and filter sign names directly rather than through string system. #7304

Merged
merged 6 commits into from Mar 2, 2019

Conversation

PeterN
Copy link
Member

@PeterN PeterN commented Mar 1, 2019

No description provided.

@PeterN PeterN changed the title Codechange: Need need to buffer and format sign strings, they are C-style strings to start with Codechange: No need need to buffer and format sign strings, they are C-style strings to start with Mar 1, 2019
@PeterN PeterN changed the title Codechange: No need need to buffer and format sign strings, they are C-style strings to start with Codechange: No need to buffer and format sign strings, they are C-style strings to start with Mar 1, 2019
@PeterN
Copy link
Member Author

PeterN commented Mar 1, 2019

Probably need to handle if Sign::name is null.

@SamuXarick
Copy link
Contributor

Faster, but still…
unnamed 1956-09-16

@PeterN
Copy link
Member Author

PeterN commented Mar 2, 2019

This is now a fairly major improvement when a lot of signs are placed, and signs are added/remove regularly. This is not a normal situation but is achievable with debug options on some AIs (AIAI in this case).

sign-sorter

  • master: ~240ms/t, game runs at 0.1x speed
  • this PR: ~10ms/t, game runs at faster than real-time.

@nielsmh
Copy link
Contributor

nielsmh commented Mar 2, 2019

This makes me wonder how much performance gain could be had by (somehow) optimising the entire FormatString flow.

@PeterN
Copy link
Member Author

PeterN commented Mar 2, 2019

Using FormatString once will still needlessly (for the purposes of sorting/filtering) duplicate each string, but it may help.

@PeterN PeterN added this to the 1.9.0 milestone Mar 2, 2019
Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine, but 6 commits looks like a lot, perhaps some of them should be merged together?

@PeterN PeterN changed the title Codechange: No need to buffer and format sign strings, they are C-style strings to start with Codechange: Sort and filter sign names directly rather than through string system. Mar 2, 2019
@PeterN PeterN merged commit cbaf52f into OpenTTD:master Mar 2, 2019
@PeterN PeterN deleted the sign-sorter branch March 2, 2019 17:08
@PeterN
Copy link
Member Author

PeterN commented Mar 2, 2019

Closes #7303

nielsmh pushed a commit to nielsmh/OpenTTD that referenced this pull request Mar 11, 2019
…tring system. (OpenTTD#7304)

This provides a notable performance benefit in the Sign List window when there are many signs.
douiwby pushed a commit to douiwby/OpenTTD that referenced this pull request Apr 16, 2020
…tring system. (OpenTTD#7304)

This provides a notable performance benefit in the Sign List window when there are many signs.
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

4 participants