Skip to content

Precompiled headers#15

Merged
HyperWinX merged 23 commits intoHyperCPU-Project:masterfrom
aceinetx:precompiled-headers
Apr 18, 2025
Merged

Precompiled headers#15
HyperWinX merged 23 commits intoHyperCPU-Project:masterfrom
aceinetx:precompiled-headers

Conversation

@aceinetx
Copy link
Contributor

Needs testing
This PR speeds up compilation times (from 10m 30s avg. to 8m 30s avg. according to 2 ci/cd runs) by adding precompiled headers.

@mentatbot
Copy link

mentatbot bot commented Apr 15, 2025

If you would like me to review this PR, either tag me in a comment or check this box:
✅ Review PR

You can disable automatic comments on my settings page

@mentatbot
Copy link

mentatbot bot commented Apr 15, 2025

I'm getting to work. See my steps and track my cost here.

  • Wake on any new activity.
    I always see new activity while actively working. When paused, I'll only respond when tagged unless this box is checked.

Copy link

@mentatbot mentatbot bot left a comment

Choose a reason for hiding this comment

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

PR Review: Precompiled Headers Implementation

I've reviewed the implementation of precompiled headers in the codebase and it looks well-executed with a clear performance benefit. Adding precompiled headers is a great way to improve build times, especially for C++ projects with many headers.

Strengths

  1. Performance Improvement: The 2-minute reduction in build time (from 10m 30s to 8m 30s) is a significant improvement that will benefit developers.

  2. Clean Implementation:

    • The PCH files are well-organized with standard headers that rarely change.
    • The src/pch.hpp has comprehensive coverage of std library headers.
    • The test/pch.hpp is appropriately minimal with just what's needed for tests.
  3. Build System Changes: The CMake integration is correctly done with target_precompile_headers() for all relevant targets.

  4. Workflow Improvement: Updating the GitHub workflow to use actions/checkout@v4 is a good practice over manual git commands.

Minor Issues

  1. Empty Header File: src/Emulator/Core/CPU/Interrupts/InterruptHandler.hpp appears to be empty. Is this intentional?

  2. A Few Redundant Includes: Some files like src/Emulator/Misc/print.hpp include headers directly that are already in the PCH. While not a functional issue, it's slightly inconsistent.

  3. Optimization Potential: The fmt-related includes could potentially be further optimized to ensure they're only in the PCH to avoid duplicate inclusion.

Conclusion

This is a solid PR that achieves its goal of improving build times. The implementation follows best practices for precompiled headers, and the approach taken is clean and maintainable.

The PR is ready to merge from my perspective, as the issues noted are minor and don't affect functionality.

@HyperWinX HyperWinX merged commit 353c7c4 into HyperCPU-Project:master Apr 18, 2025
9 checks passed
HyperWinX pushed a commit that referenced this pull request Apr 21, 2025
* Add pch.hpp with the needed headers

* cmake: precompile pch.hpp

* pch.hpp: add comments

* Use pch.hpp in Assembler/Core/Compiler.*pp

* Correct formatting

* Don't include fmt/base.h

* Include pch.hpp instead of some system headers

* add ```#pragma once```

* update a comment

* Switch from gtest/gtest.h to pch.hpp

* Remove non-existent header

* Remove ```#pragma once``` in pch's

* Fix recursive includes

* Add fmt/base.h to pch.hpp

* Revert ac07153

* Include only needed headers in Emulator/Misc/print.hpp

* Include only needed headers in Emulator/Misc/bit_cast.hpp

* Update pch

* Fix workflow

* Remove empty header that I created for some reason

* Revert workflow fix

* Update distro-ci workflow

* Update workflow
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

Comments