Skip to content
This repository was archived by the owner on Aug 5, 2023. It is now read-only.

[WIP] Optimize SongData file writes by keeping file handle open#32

Open
bkirz wants to merge 2 commits intobenank:mainfrom
bkirz:bkirz/optimize-frequent-file-writes
Open

[WIP] Optimize SongData file writes by keeping file handle open#32
bkirz wants to merge 2 commits intobenank:mainfrom
bkirz:bkirz/optimize-frequent-file-writes

Conversation

@bkirz
Copy link

@bkirz bkirz commented Jul 26, 2021

This is a WIP that needs fixing before it can be safely merged.

The goal of this PR is to reduce time spent opening/closing file handles during gameplay by reusing the same open filehandle when updating the song data file. It contains the following changes:

  • Update everyone.dance.lua to keep a persistent file handle open for the song data file.
  • Update writing song data to seek to the beginning of the file first before writing, and write extra newlines at the end of the file.
  • Update the electron client to stop parsing the song data file after the first blank line encountered to prevent accidentally reading partially-overwritten data from previous writes.

WIP:

  • Getting failures when I get to the song wheel in SM5/SL5.0.1 that the file isn't properly opened. I assume I'm getting the control flow a bit incorrect.
  • Haven't set up testing with the electron client yet, not sure if there are any gotchas on the client side.

Current lua failure on load:

00:17.101: WARNING: Error playing command:/Themes/Simply Love (For E.D Testing)/BGAnimations/everyone.dance.lua:31: File '/Users/bkirz/Library/Prefer
ences/StepMania 5.1/everyone.dance.txt' is not open for reading.          
00:17.101: WARNING: [C]: Seek( = (null))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant