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

Speed up getting a list of files on PS Vita #9310

Merged
merged 14 commits into from
Dec 3, 2024

Conversation

oleg-derevenetz
Copy link
Collaborator

@oleg-derevenetz oleg-derevenetz commented Dec 1, 2024

fix #9309

  • Don't try to find the actual case-sensitive path using its case-insensitive variant;
  • Use the native filesystem API to get the list of files in a directory instead of std::filesystem::directory_iterator;
  • Place the fheroes2 version info into the param.sfo;
  • Optimize the ListFiles::FindFileInDir().

@oleg-derevenetz oleg-derevenetz changed the title PS Vita: don't try to find the case-sensitive path using its case-insensitive variant PS Vita: don't try to find the actual case-sensitive path using its case-insensitive variant Dec 1, 2024
@Districh-ru
Copy link
Collaborator

The last commits show New Game menu load speed-up: about 560 ms on Vita3K emulator. It is faster than master build (~850 ms), but a little slower than v.1.1.2 (~350 ms).

@oleg-derevenetz
Copy link
Collaborator Author

The last commits show New Game menu load speed-up: about 560 ms on Vita3K emulator. It is faster than master build (~850 ms), but a little slower than v.1.1.2 (~350 ms).

Well, we also can make a "special case" for System::IsFile() and System::isDirectory(), but originally on PS Vita they didn't verify that the given name is really a file or a directory, they only verified that the file with the given name exists. Now it is all verified.

@Districh-ru
Copy link
Collaborator

I've asked Pønytail on Discord to test the new build when he have time. I've added the load time estimation to the New Game menu:

    fheroes2::Time counter;
    counter.reset();
    
    // Code to estimate execution time.

    const double timeMs = counter.getS() * 1000;
    fheroes2::showStandardTextMessage( "Time for menu", std::to_string( timeMs ) + " ms.", Dialog::OK );

Lets check the real hardware. If the load time of New Game is normal (less then a couple of seconds) then it is better to keep file verification in cost of some commutation time.

@Districh-ru
Copy link
Collaborator

Districh-ru commented Dec 1, 2024

The 99e4c1e commit has almost no affect on menu load speed on Vita3K emulator. It is about 560 ms.

@oleg-derevenetz
Copy link
Collaborator Author

The 99e4c1e commit has almost no affect on menu load speed on Vita3K emulator. It is about 560 ms.

Well, if it doesn't give anything on a real device as well, it would be better to roll it back. The less "special" code, the better.

@Districh-ru
Copy link
Collaborator

Well, if it doesn't give anything on a real device as well, it would be better to roll it back. The less "special" code, the better.

I've asked Pønytail to test this change as well. Let's wait for his response on Discord (most probably tomorrow).

@Districh-ru
Copy link
Collaborator

Districh-ru commented Dec 1, 2024

Pønytail reported that both versions (with 99e4c1e and without it) act the same and are close to v 1.1.2:

Попробовал обе версии! Отклик "новой игры" 430мс, отклик "обычной игры" 56с. Результат аналогичный версии 1.1.2.

So we can revert the last commit since it has no benefits.

Since we are updating PS Vita related code we could also properly show version number in PS Vita by updating the Makefile.vita file.
Add after line 31:
PROJECT_VERSION := $(file < version.txt)
and update line 59:
vita-mksfoex -s TITLE_ID="$(PROJECT_TITLEID)" -s APP_VER="$(PROJECT_VERSION)" "$(PROJECT_TITLE)" param.sfo

изображение

Currently it is always 0.00
изображение

What do you think, @oleg-derevenetz ?

@oleg-derevenetz oleg-derevenetz changed the title PS Vita: don't try to find the actual case-sensitive path using its case-insensitive variant Speed up getting a list of files on PS Vita Dec 1, 2024
@oleg-derevenetz oleg-derevenetz added the regression Something went wrong in previous commits label Dec 1, 2024
@oleg-derevenetz oleg-derevenetz added this to the 1.1.5 milestone Dec 1, 2024
@oleg-derevenetz oleg-derevenetz added the improvement New feature, request or improvement label Dec 1, 2024
@oleg-derevenetz oleg-derevenetz marked this pull request as ready for review December 2, 2024 00:06
Copy link
Collaborator

@Districh-ru Districh-ru left a comment

Choose a reason for hiding this comment

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

Tested with Vita3K emulator - New Game menu load time is OK (~550 ms).

@ihhub ihhub merged commit 25d8607 into ihhub:master Dec 3, 2024
20 checks passed
@ihhub
Copy link
Owner

ihhub commented Dec 3, 2024

@oleg-derevenetz , many thanks for this fix!

@oleg-derevenetz oleg-derevenetz deleted the ps-vita-io-fix branch December 3, 2024 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement New feature, request or improvement regression Something went wrong in previous commits
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Openning New Game menu lags on PS Vita
3 participants