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

[hlc] Speed up hlc visual studio templates #720

Merged
merged 2 commits into from
Oct 25, 2024

Conversation

tobil4sk
Copy link
Member

Currently, each file requires a separate cl.exe invocation. This PR reduces the number of cl.exe invocations needed to build the project by allowing multiple files to be compiled in the same cl.exe invocation (by passing object output directory instead of object output file name, which means more files share the same compilation arguments). This already gives a noticeable speed up.

It further improves the speed by enabling multi processor compilation, which is possible now that the same cl.exe invocation deals with multiple files.

As an example, on my machine with the HelloWorld program in other/tests, compilation speed goes from 18.6 seconds to 7.3 seconds.

Further speed up is possible if /Fo is removed from the cl.exe invocation altogether (since then all files can be compiled in one invocation). However, this would cause issues if files in different directories share a name, since by default cl.exe puts all object files in the same directory.

Since the %(Filename) variable is unique for each compiled file, this
resulted in a separate cl.exe invocation for each file. This makes us
unable to make use of /MP to speed up cl.exe.

We can instead simply pass the directory and the file name will be
added to the end automatically. This still means that there is a
separate cl.exe invocation per directory, however, this is much faster
already. The %(RelativeDir) must remain otherwise all object files are
placed in a single directory. This would be a problem if two files share
a name.
@tobil4sk tobil4sk changed the title Speed up hlc visual studio templates [hlc] Speed up hlc visual studio templates Oct 25, 2024
@yuxiaomao yuxiaomao merged commit e8c9014 into HaxeFoundation:master Oct 25, 2024
10 checks passed
@tobil4sk tobil4sk deleted the speed-up-hlc-templates branch October 25, 2024 09:14
GlassySundew pushed a commit to GlassySundew/hashlink that referenced this pull request Nov 23, 2024
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.

2 participants