Skip to content

speeded up game exports for large projects by optimizing file lookups - #8992

Open
brolookslikeanfish67-hub wants to merge 2 commits into
4ian:masterfrom
brolookslikeanfish67-hub:master
Open

speeded up game exports for large projects by optimizing file lookups#8992
brolookslikeanfish67-hub wants to merge 2 commits into
4ian:masterfrom
brolookslikeanfish67-hub:master

Conversation

@brolookslikeanfish67-hub

Copy link
Copy Markdown

Description

This PR optimizes the file compilation loop within the GDJS Exporter pipeline (GDJS/IDE/Exporter.cpp).

The Problem:

InsertUnique was executing a sequential std::find check on std::vector lists for every source, dependency, library, and asset requirement during an export pipeline. This created a standard O(N虏) computational bottleneck for complex visual game projects containing heavily scaled modular extension libraries.

The Fix:

  • Transitioned uniquely tracked resource lists to stack-allocated tracking blocks using std::unordered_set hash lookups. This drops insertion checking from O(N) down to O(1).
  • Encapsulated helper functionality cleanly inside an anonymous namespace to avoid polluting the global file space.
  • Swapped gd::String value parameters out for const gd::String& references inside local scope definitions to drop memory allocation requirements entirely.
  • Modernized explicit class destructor mappings to use contemporary = default; architecture.

Why this is safe:

The tracking sets are completely stack-contained inside exportProject. This prevents permanent class-level state inflation while maintaining full algorithmic optimizations during hot paths.

Refactor Exporter class to improve performance and readability by using unordered_set for unique insertion. Modernize code and clean up comments.
Refactor InsertUnique function for thread safety and efficiency. Update comments for clarity and memory management.
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