Improve build time of Q# standard library and its tests #437
Description
Describe the enhancement request
Currently building Q# Standard Library takes 55 seconds and building it together with tests takes 01:27.
This might not seem like a long time for a language's standard library to build,
however the number of lines of code in Q# standard library excluding comments and blank lines is 5303 ( measured for commit 55df2709294f27a55f286bab799d60ae81e829d3 ).
Including tests there are 8376 lines of Q# code.
To Reproduce
For libraries build time:
git clone https://github.com/microsoft/QuantumLibraries.git
cd .\QuantumLibraries\Standard\src\
dotnet restore
dotnet build --no-restore
For tests
cd ..\tests\
dotnet restore
dotnet build --no-restore
Expected behavior
One would expect compiling around 5000 lines of Q# code into C# to be at least comparable in speed to compiling 5000 lines of C# code.
Q# is a much simpler language than C# if you look at its syntax and type system, so one would expect that compiler for it should be at least as fast as C#.
System information
- OS: Windows
- .NET Core Version: 3.1.201
- Build is run on a dedicated SSD Samsung SSD 960 EVO 500 GB, separate from the SSD on which Windows is installed
- CPU: Intel(R) Core(TM) i7-7700T CPU @ 2.90GHz set to full performance
- 32 GB RAM
Additional context
Measuring number of lines excluding blank lines and comments
To count the number of lines we used cloc with the following language definition file:
Q#
filter rm_comments_in_strings " //
filter call_regexp_common C++
3rd_gen_scale 1.36
extension qs
end_of_line_continuation \\$
cloc
can be installed on windows with choco install cloc
.
See video showing build process.
Notice that the build does not take full advantage of available memory and processor.