Skip to content

⚡ Optimize Citra Per-Game Config with Single File I/O#31

Merged
Ven0m0 merged 5 commits intomainfrom
jules-75104337869570791-4082b6fa
Feb 10, 2026
Merged

⚡ Optimize Citra Per-Game Config with Single File I/O#31
Ven0m0 merged 5 commits intomainfrom
jules-75104337869570791-4082b6fa

Conversation

@Ven0m0
Copy link
Owner

@Ven0m0 Ven0m0 commented Feb 10, 2026

💡 What:
Refactored Citra-per-game.ahk to read the configuration file into a memory variable once, perform all text replacements on this variable using TF library functions, and save the file only once at the end of the script.

🎯 Why:
The previous implementation performed a file read, modification, and write operation for every single configuration setting changed. A typical game profile application involves 5-6 such operations.
This led to:

  • Redundant disk I/O (O(N) vs O(1)).
  • Increased latency, especially if the config file is on a network drive or synchronized folder (e.g., OneDrive, as seen in the path).
  • Potential race conditions or file lock issues if executed rapidly or concurrently.

📊 Measured Improvement:

  • Baseline: ~5-6 File Open/Read/Write/Close cycles per execution.
  • Optimized: 1 File Read + 1 File Write per execution.
  • While exact timing benchmarks were not run (due to environment constraints), the complexity reduction from O(N) I/O to O(1) I/O guarantees a performance improvement and reduced system stress.

Changes:

  • Helper functions (SetRes, SetFilter, etc.) now update a global ConfigText variable instead of calling TF_Replace on the file path.
  • Added FileRead, ConfigText, %CitraConfigFile% at the start of the main logic.
  • Added TF_Save(ConfigText, CitraConfigFile) at the end of the main logic.
  • Preserved all existing logic and conditional branches.

PR created automatically by Jules for task 75104337869570791 started by @Ven0m0

…cements

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings February 10, 2026 06:53
@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the legacy (v1) Citra per-game config applicator to avoid repeated disk I/O by loading qt-config.ini into memory once, performing all TF-based edits in-memory, and writing the result once at the end.

Changes:

  • Introduced a global ConfigText buffer and updated helper functions (SetRes, SetFilter, etc.) to operate on it instead of editing the file on each call.
  • Added a single FileRead before applying game-specific settings.
  • Added a single TF_Save after applying settings to persist changes once.

Ven0m0 and others added 4 commits February 10, 2026 11:15
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Ven0m0 Ven0m0 merged commit 49ae8b3 into main Feb 10, 2026
1 of 2 checks passed
@Ven0m0 Ven0m0 deleted the jules-75104337869570791-4082b6fa branch February 10, 2026 10:16
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.

1 participant