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

Add a Compiler option to profile the compilation time #1614

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

adevress
Copy link
Contributor

@adevress adevress commented Nov 12, 2024

Dear all,

I have added an option to the compiler in the spirit of clang -ftime-trace to profile and report the time taken by each phase of the compilation of hc.

This is an example of such report

./Sources/hc  ../Examples/factorial.hylo  -o test --profile-compiler  
**Compile time profiling summary**
  Frontend:
    Lexer: 69.934 us
    Parser: 496.462 us
    TypeChecker: 1.537 s
  Backend:
    IR Lowering: 1.042 s
    Depolymorphize: 100.963 ms
    LLVM IR Conversion: 539.563 ms                   
    LLVM Mandatory pass: 90.476 ms                
    LLVM Optimizations: N/A
    LLVM Emit phase: 1.413 s
    Linking phase: 51.975 ms

If you find that useful, let me know and I will do the necessary to respect the CONTRIBUTING guidelines and iterate on that.

PS: I am not experienced in Swift. That might currently be my first PR in Swift. Do not hesitate to point any obvious wrong usage of the language.

Copy link

codecov bot commented Nov 16, 2024

Codecov Report

Attention: Patch coverage is 61.66667% with 92 lines in your changes missing coverage. Please review.

Project coverage is 88.23%. Comparing base (f1b2d58) to head (64022db).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
Sources/Utils/Profiling.swift 0.00% 64 Missing ⚠️
Sources/Driver/Driver.swift 76.92% 9 Missing ⚠️
.../GenerateHyloFileTests/GenerateHyloFileTests.swift 0.00% 6 Missing ⚠️
Sources/IR/Operands/Instruction/UnionSwitch.swift 0.00% 4 Missing ⚠️
Sources/FrontEnd/TypedProgram.swift 71.42% 2 Missing ⚠️
Sources/FrontEnd/Parse/Parser.swift 90.90% 1 Missing ⚠️
Sources/FrontEnd/TypeChecking/TypeChecker.swift 85.71% 1 Missing ⚠️
...ces/IR/Analysis/Module+NormalizeObjectStates.swift 94.73% 1 Missing ⚠️
Sources/IR/Module.swift 50.00% 1 Missing ⚠️
Sources/IR/Operands/Instruction/Switch.swift 0.00% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1614      +/-   ##
==========================================
- Coverage   88.28%   88.23%   -0.05%     
==========================================
  Files         381      382       +1     
  Lines       22910    30483    +7573     
==========================================
+ Hits        20225    26897    +6672     
- Misses       2685     3586     +901     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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