Skip to content

Commit

Permalink
some small performance fixes, in addition to fsprojects/Paket#3173
Browse files Browse the repository at this point in the history
  • Loading branch information
matthid committed Apr 30, 2018
1 parent ae3752c commit d373860
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 76 deletions.
64 changes: 32 additions & 32 deletions .fake/build.fsx/intellisense.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,43 +60,43 @@
#r "C:\\Users\\matth\\.nuget\\packages\\system.runtime\\4.3.0\\lib\\net462\\System.Runtime.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\system.security.principal.windows\\4.4.1\\lib\\net461\\System.Security.Principal.Windows.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\system.security.cryptography.protecteddata\\4.4.0\\lib\\net461\\System.Security.Cryptography.ProtectedData.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.xml\\5.0.0-rc006\\lib\\net46\\Fake.Core.Xml.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.semver\\5.0.0-rc006\\lib\\net46\\Fake.Core.SemVer.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\paket.core\\5.156.5\\lib\\net45\\Paket.Core.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.api.github\\5.0.0-rc006\\lib\\net46\\Fake.Api.GitHub.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.context\\5.0.0-rc006\\lib\\net46\\Fake.Core.Context.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.environment\\5.0.0-rc006\\lib\\net46\\Fake.Core.Environment.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.string\\5.0.0-rc006\\lib\\net46\\Fake.Core.String.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.xml\\5.0.0-rc008\\lib\\net46\\Fake.Core.Xml.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.semver\\5.0.0-rc008\\lib\\net46\\Fake.Core.SemVer.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\paket.core\\5.156.7\\lib\\net45\\Paket.Core.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.api.github\\5.0.0-rc008\\lib\\net46\\Fake.Api.GitHub.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.context\\5.0.0-rc008\\lib\\net46\\Fake.Core.Context.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.environment\\5.0.0-rc008\\lib\\net46\\Fake.Core.Environment.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.string\\5.0.0-rc008\\lib\\net46\\Fake.Core.String.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fparsec\\1.0.3\\lib\\net40-client\\FParsec.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\system.reflection.metadata\\1.5.0\\lib\\netstandard2.0\\System.Reflection.Metadata.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\mono.cecil\\0.10.0\\lib\\net40\\Mono.Cecil.Rocks.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\mono.cecil\\0.10.0\\lib\\net40\\Mono.Cecil.Pdb.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\mono.cecil\\0.10.0\\lib\\net40\\Mono.Cecil.Mdb.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.releasenotes\\5.0.0-rc006\\lib\\net46\\Fake.Core.ReleaseNotes.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.io.filesystem\\5.0.0-rc006\\lib\\net46\\Fake.IO.FileSystem.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.commandlineparsing\\5.0.0-rc006\\lib\\net46\\Fake.Core.CommandLineParsing.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.trace\\5.0.0-rc006\\lib\\net46\\Fake.Core.Trace.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.buildserver.teamfoundation\\5.0.0-rc006\\lib\\net46\\Fake.BuildServer.TeamFoundation.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.buildserver.travis\\5.0.0-rc006\\lib\\net46\\Fake.BuildServer.Travis.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.tasks\\5.0.0-rc006\\lib\\net46\\Fake.Core.Tasks.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.testing.common\\5.0.0-rc006\\lib\\net46\\Fake.Testing.Common.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.process\\5.0.0-rc006\\lib\\net46\\Fake.Core.Process.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.assemblyinfofile\\5.0.0-rc006\\lib\\net46\\Fake.DotNet.AssemblyInfoFile.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.io.zip\\5.0.0-rc006\\lib\\net46\\Fake.IO.Zip.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.target\\5.0.0-rc006\\lib\\net46\\Fake.Core.Target.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.net.http\\5.0.0-rc006\\lib\\net46\\Fake.Net.Http.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.buildserver.appveyor\\5.0.0-rc006\\lib\\net46\\Fake.BuildServer.AppVeyor.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.buildserver.teamcity\\5.0.0-rc006\\lib\\net46\\Fake.BuildServer.TeamCity.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.nuget\\5.0.0-rc006\\lib\\net46\\Fake.DotNet.NuGet.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.testing.mspec\\5.0.0-rc006\\lib\\net46\\Fake.DotNet.Testing.MSpec.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.testing.nunit\\5.0.0-rc006\\lib\\net46\\Fake.DotNet.Testing.NUnit.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.testing.xunit2\\5.0.0-rc006\\lib\\net46\\Fake.DotNet.Testing.XUnit2.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.cli\\5.0.0-rc006\\lib\\net46\\Fake.DotNet.Cli.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.fsformatting\\5.0.0-rc006\\lib\\net46\\Fake.DotNet.FSFormatting.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.msbuild\\5.0.0-rc006\\lib\\net46\\Fake.DotNet.MSBuild.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.paket\\5.0.0-rc006\\lib\\net46\\Fake.DotNet.Paket.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.tools.git\\5.0.0-rc006\\lib\\net46\\Fake.Tools.Git.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.windows.chocolatey\\5.0.0-rc006\\lib\\net46\\Fake.Windows.Chocolatey.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.releasenotes\\5.0.0-rc008\\lib\\net46\\Fake.Core.ReleaseNotes.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.io.filesystem\\5.0.0-rc008\\lib\\net46\\Fake.IO.FileSystem.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.commandlineparsing\\5.0.0-rc008\\lib\\net46\\Fake.Core.CommandLineParsing.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.trace\\5.0.0-rc008\\lib\\net46\\Fake.Core.Trace.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.buildserver.teamfoundation\\5.0.0-rc008\\lib\\net46\\Fake.BuildServer.TeamFoundation.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.buildserver.travis\\5.0.0-rc008\\lib\\net46\\Fake.BuildServer.Travis.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.tasks\\5.0.0-rc008\\lib\\net46\\Fake.Core.Tasks.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.testing.common\\5.0.0-rc008\\lib\\net46\\Fake.Testing.Common.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.process\\5.0.0-rc008\\lib\\net46\\Fake.Core.Process.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.assemblyinfofile\\5.0.0-rc008\\lib\\net46\\Fake.DotNet.AssemblyInfoFile.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.io.zip\\5.0.0-rc008\\lib\\net46\\Fake.IO.Zip.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.core.target\\5.0.0-rc008\\lib\\net46\\Fake.Core.Target.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.net.http\\5.0.0-rc008\\lib\\net46\\Fake.Net.Http.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.buildserver.appveyor\\5.0.0-rc008\\lib\\net46\\Fake.BuildServer.AppVeyor.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.buildserver.teamcity\\5.0.0-rc008\\lib\\net46\\Fake.BuildServer.TeamCity.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.nuget\\5.0.0-rc008\\lib\\net46\\Fake.DotNet.NuGet.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.testing.mspec\\5.0.0-rc008\\lib\\net46\\Fake.DotNet.Testing.MSpec.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.testing.nunit\\5.0.0-rc008\\lib\\net46\\Fake.DotNet.Testing.NUnit.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.testing.xunit2\\5.0.0-rc008\\lib\\net46\\Fake.DotNet.Testing.XUnit2.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.cli\\5.0.0-rc008\\lib\\net46\\Fake.DotNet.Cli.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.fsformatting\\5.0.0-rc008\\lib\\net46\\Fake.DotNet.FSFormatting.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.msbuild\\5.0.0-rc008\\lib\\net46\\Fake.DotNet.MSBuild.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.dotnet.paket\\5.0.0-rc008\\lib\\net46\\Fake.DotNet.Paket.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.tools.git\\5.0.0-rc008\\lib\\net46\\Fake.Tools.Git.dll"
#r "C:\\Users\\matth\\.nuget\\packages\\fake.windows.chocolatey\\5.0.0-rc008\\lib\\net46\\Fake.Windows.Chocolatey.dll"
#r "System"
#r "System.Core"
#r "System.Security"
Expand Down
26 changes: 25 additions & 1 deletion src/app/Fake.Runtime/FSharpParser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,30 @@ type AnalyseState =
| NoAnalysis
| Reference of string option

(*
let findInterestingItems (tokens:Token list) =
let rec analyseNextToken (_, state) (tok :Token) =
match state with
| NoAnalysis ->
if tok.TokenInfo.IsSome && tok.TokenInfo.Value.TokenName = "HASH" && tok.Representation = "#r" then
None, Reference None
else None, NoAnalysis
| Reference None -> // Initial string start
if tok.TokenInfo.IsSome && tok.TokenInfo.Value.TokenName = "STRING_TEXT" then
None, Reference (Some "")
else None, Reference None
| Reference (Some s) -> // read string
if tok.TokenInfo.IsNone || (tok.TokenInfo.IsSome && tok.TokenInfo.Value.TokenName = "STRING_TEXT") then
None, Reference (Some (s + tok.Representation))
elif tok.TokenInfo.IsSome && tok.TokenInfo.Value.TokenName = "STRING" then
Some (InterestingItem.Reference s), NoAnalysis
else failwithf "No idea how %A can happen in a string" (tok, tok.Representation) // None, Reference (Some s)
tokens
|> Seq.scan analyseNextToken (None, NoAnalysis)
|> Seq.choose fst
|> Seq.toList*)

let findInterestingItems defines (scriptFile:string) (scriptText:string) =
let rec tokenizeLine results (line:string) (tokenizer:FSharpLineTokenizer) state =
match tokenizer.ScanToken(state) with
Expand Down Expand Up @@ -173,4 +197,4 @@ let findInterestingItems defines (scriptFile:string) (scriptText:string) =
|> tokenizeLines sourceTok 0L
|> Seq.scan analyseNextToken (None, NoAnalysis)
|> Seq.choose fst
|> Seq.toList
|> Seq.toList
Loading

0 comments on commit d373860

Please sign in to comment.