The Computer Language
Benchmarks Game

regex-redux F# .NET Core #5 program

source code

// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org/
//
// regex-dna program contributed by David Grenier
// converted from regex-dna program
// parallelization by Peter Kese

open System.Text.RegularExpressions
open Microsoft.FSharp.Collections

let regex s = Regex (s, RegexOptions.Compiled)
let input = stdin.ReadToEnd ()
let text = (regex ">.*\n|\n").Replace (input, "")

let matchTasks = 
    [   "agggtaaa|tttaccct"
        "[cgt]gggtaaa|tttaccc[acg]"
        "a[act]ggtaaa|tttacc[agt]t"
        "ag[act]gtaaa|tttac[agt]ct"
        "agg[act]taaa|ttta[agt]cct"
        "aggg[acg]aaa|ttt[cgt]ccct"
        "agggt[cgt]aa|tt[acg]accct"
        "agggta[cgt]a|t[acg]taccct"
        "agggtaa[cgt]|[acg]ttaccct"]
    |> List.map (fun pattern () ->
        ((regex pattern).Matches text).Count
            |> sprintf "%s %i\n" pattern) 

let replaceTask () =
    [
        "tHa[Nt]", "<4>"
        "aND|caN|Ha[DS]|WaS", "<3>"
        "a[NSt]|BY", "<2>"
        "<[^>]*>", "|"
        "\\|[^|][^|]*\\|","-"]
    |> List.fold (fun s (pattern, replace) -> 
        (regex pattern).Replace (s, replace)) text
    |> String.length
    |> sprintf "\n%i\n%i\n%i\n" input.Length text.Length

replaceTask :: (matchTasks |> List.rev )
|> List.toArray
|> Array.Parallel.map (fun task -> task ())
|> Array.rev
|> Array.iter (printf "%s")
    

notes, command-line, and program output

NOTES:
64-bit Ubuntu quad core
2.0.0-preview1-005977
"System.GC.Server": true


Thu, 08 Jun 2017 21:59:22 GMT

MAKE:
cp regexredux.fsharpcore-5.fsharpcore Program.fs
cp Include/fsharpcore/tmp.fsproj .
cp Include/fsharpcore/runtimeconfig.template.json .
mkdir obj
cp Include/fsharpcore/project.assets.json ./obj
cp Include/fsharpcore/tmp.fsproj.nuget.g.props ./obj
cp Include/fsharpcore/tmp.fsproj.nuget.g.targets ./obj
/usr/bin/dotnet build -c Release
Microsoft (R) Build Engine version 15.3.117.23532
Copyright (C) Microsoft Corporation. All rights reserved.

/home/dunham/.nuget/packages/fsharp.net.sdk/1.0.5/build/FSharp.NET.Core.Sdk.targets(170,9): error MSB6006: "dotnet" exited with code 131. [/home/dunham/benchmarksgame_quadcore/regexredux/tmp/tmp.fsproj]

Build FAILED.

/home/dunham/.nuget/packages/fsharp.net.sdk/1.0.5/build/FSharp.NET.Core.Sdk.targets(170,9): error MSB6006: "dotnet" exited with code 131. [/home/dunham/benchmarksgame_quadcore/regexredux/tmp/tmp.fsproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:02.79
/home/dunham/benchmarksgame/nanobench/makefiles/u64q.programs.Makefile:189: recipe for target 'regexredux.fsharpcore-5.fsharpcore_run' failed
make: [regexredux.fsharpcore-5.fsharpcore_run] Error 1 (ignored)

3.33s to complete and log all make actions

COMMAND LINE:
/usr/bin/dotnet ./bin/Release/netcoreapp2.0/tmp.dll 0 < regexredux-input50000.txt

PROGRAM FAILED 


PROGRAM OUTPUT:

No executable found matching command "dotnet-./bin/Release/netcoreapp2.0/tmp.dll"