Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3f8bcb2

Browse files
committed
Initial benchmarking
1 parent4a9274b commit3f8bcb2

File tree

5 files changed

+138
-0
lines changed

5 files changed

+138
-0
lines changed

‎benchmarks/Benchmarks.sln‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion =15.0.28307.136
5+
MinimumVisualStudioVersion =10.0.40219.1
6+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") ="CompilerServiceBenchmarks","CompilerServiceBenchmarks\CompilerServiceBenchmarks.fsproj","{9A3C565C-B514-4AE0-8B01-CA80E8453EB0}"
7+
EndProject
8+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") ="FSharp.Core","..\src\fsharp\FSharp.Core\FSharp.Core.fsproj","{BB9EAE76-194A-49D8-9618-586CBE7031D9}"
9+
EndProject
10+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") ="FSharp.Compiler.Private","..\src\fsharp\FSharp.Compiler.Private\FSharp.Compiler.Private.fsproj","{F57B02B1-CF26-4D93-9211-8CEB4F1572F0}"
11+
EndProject
12+
Global
13+
GlobalSection(SolutionConfigurationPlatforms) =preSolution
14+
Debug|Any CPU=Debug|Any CPU
15+
Release|Any CPU=Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) =postSolution
18+
{9A3C565C-B514-4AE0-8B01-CA80E8453EB0}.Debug|Any CPU.ActiveCfg=Debug|Any CPU
19+
{9A3C565C-B514-4AE0-8B01-CA80E8453EB0}.Debug|Any CPU.Build.0=Debug|Any CPU
20+
{9A3C565C-B514-4AE0-8B01-CA80E8453EB0}.Release|Any CPU.ActiveCfg=Release|Any CPU
21+
{9A3C565C-B514-4AE0-8B01-CA80E8453EB0}.Release|Any CPU.Build.0=Release|Any CPU
22+
{BB9EAE76-194A-49D8-9618-586CBE7031D9}.Debug|Any CPU.ActiveCfg=Debug|Any CPU
23+
{BB9EAE76-194A-49D8-9618-586CBE7031D9}.Debug|Any CPU.Build.0=Debug|Any CPU
24+
{BB9EAE76-194A-49D8-9618-586CBE7031D9}.Release|Any CPU.ActiveCfg=Release|Any CPU
25+
{BB9EAE76-194A-49D8-9618-586CBE7031D9}.Release|Any CPU.Build.0=Release|Any CPU
26+
{F57B02B1-CF26-4D93-9211-8CEB4F1572F0}.Debug|Any CPU.ActiveCfg=Debug|Any CPU
27+
{F57B02B1-CF26-4D93-9211-8CEB4F1572F0}.Debug|Any CPU.Build.0=Debug|Any CPU
28+
{F57B02B1-CF26-4D93-9211-8CEB4F1572F0}.Release|Any CPU.ActiveCfg=Release|Any CPU
29+
{F57B02B1-CF26-4D93-9211-8CEB4F1572F0}.Release|Any CPU.Build.0=Release|Any CPU
30+
EndGlobalSection
31+
GlobalSection(SolutionProperties) =preSolution
32+
HideSolutionNode =FALSE
33+
EndGlobalSection
34+
GlobalSection(ExtensibilityGlobals) =postSolution
35+
SolutionGuid ={049A4D02-709F-418C-AD59-7FB0DBE956B1}
36+
EndGlobalSection
37+
EndGlobal
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<ProjectSdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp2.1</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<CompileInclude="Program.fs" />
10+
</ItemGroup>
11+
12+
</Project>

‎benchmarks/Benchmarks/Program.fs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Learn more about F# at http://fsharp.org
2+
3+
openSystem
4+
5+
[<EntryPoint>]
6+
letmain argv=
7+
printfn"Hello World from F#!"
8+
0// return an integer exit code
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<ProjectSdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net472</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<CompileInclude="Program.fs" />
10+
</ItemGroup>
11+
12+
<ItemGroup>
13+
<PackageReferenceInclude="BenchmarkDotNet"Version="0.11.3" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<ProjectReferenceInclude="..\..\src\fsharp\FSharp.Compiler.Private\FSharp.Compiler.Private.fsproj" />
18+
<ProjectReferenceInclude="..\..\src\fsharp\FSharp.Core\FSharp.Core.fsproj" />
19+
</ItemGroup>
20+
21+
</Project>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
openSystem
2+
openSystem.IO
3+
openBenchmarkDotNet.Attributes
4+
openBenchmarkDotNet.Running
5+
openMicrosoft.FSharp.Compiler.ErrorLogger
6+
openMicrosoft.FSharp.Compiler.SourceCodeServices
7+
openSystem.Text
8+
9+
[<ClrJob(baseline=true)>]
10+
typeCompilerServiceParsing()=
11+
12+
let mutablecheckerOpt= None
13+
14+
let mutablesourceOpt= None
15+
16+
letparsingOptions=
17+
{
18+
SourceFiles=[|"TypeChecker.fs"|]
19+
ConditionalCompilationDefines=[]
20+
ErrorSeverityOptions= FSharpErrorSeverityOptions.Default
21+
IsInteractive=false
22+
LightSyntax= None
23+
CompilingFsLib=false
24+
IsExe=false
25+
}
26+
27+
[<GlobalSetup>]
28+
member__.Setup()=
29+
match checkerOptwith
30+
| None-> checkerOpt<- Some(FSharpChecker.Create())
31+
|_->()
32+
33+
match sourceOptwith
34+
| None->
35+
letsource= File.ReadAllText("""C:\visualfsharp\src\fsharp\TypeChecker.fs""")
36+
sourceOpt<- Some(source)
37+
|_->()
38+
39+
[<IterationSetup>]
40+
member__.ParsingSetup()=
41+
match checkerOptwith
42+
| None-> failwith"no checker"
43+
| Some(checker)->
44+
checker.InvalidateAll()
45+
checker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients()
46+
checker.ParseFile("dummy.fs","dummy", parsingOptions)|> Async.RunSynchronously|> ignore
47+
48+
[<Benchmark>]
49+
member__.Parsing()=
50+
match checkerOpt, sourceOptwith
51+
| None,_-> failwith"no checker"
52+
|_, None-> failwith"no source"
53+
| Some(checker), Some(source)->
54+
letresults= checker.ParseFile("TypeChecker.fs", source, parsingOptions)|> Async.RunSynchronously
55+
if results.ParseHadErrorsthen failwithf"parse had errors:%A" results.Errors
56+
57+
[<EntryPoint>]
58+
letmain argv=
59+
let_= BenchmarkRunner.Run<CompilerServiceParsing>()
60+
0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp