Skip to content

⚡ Bolt: Cache VRCUrl.Get() calls in ImageLoader#10

Open
google-labs-jules[bot] wants to merge 1 commit intomainfrom
bolt-cache-vrcurl-get-8206470906084786085
Open

⚡ Bolt: Cache VRCUrl.Get() calls in ImageLoader#10
google-labs-jules[bot] wants to merge 1 commit intomainfrom
bolt-cache-vrcurl-get-8206470906084786085

Conversation

@google-labs-jules
Copy link
Contributor

Cache VRCUrl.Get() calls in ImageLoader to reduce interop overhead.


PR created automatically by Jules for task 8206470906084786085 started by @AEmotionStudio

💡 What:
Introduced a `_cachedUrls` string array to `ImageLoader.cs` that mirrors the string values of `predefinedUrls`.
Updated `Start`, `ClearPredefinedUrls`, and relevant loops to populate and use this cache instead of calling `.Get()` repeatedly.

🎯 Why:
In UdonSharp, calling `VRCUrl.Get()` involves an interop call from the Udon VM to the Unity host, which is expensive when performed inside loops (e.g., during URL matching).

📊 Impact:
Reduces the overhead of URL lookups from O(N * Interop) to O(N * Array Access).
For lists with many predefined URLs, this significantly reduces the CPU cost during `FindMatchingUrlIndex`.

🔬 Measurement:
Verified via code review that `predefinedUrls` logic is preserved and that the cache is invalidated/updated whenever the source array might change (initialization and clearing).
@google-labs-jules
Copy link
Contributor Author

👋 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.

@AEmotionStudio AEmotionStudio marked this pull request as ready for review January 16, 2026 01:20
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.

0 participants