/mobile Handheld Friendly website
Ubuntu : Intel® Q6600® one core |
Each table row shows performance measurements for this F# Mono program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 50,000 | 2.06 | 2.07 | 35,784 | 870 | 1% 2% 0% 100% |
| 500,000 | 8.00 | 8.02 | 294,492 | 870 | 0% 0% 0% 100% |
| 5,000,000 | Failed | 870 |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read regex-dna benchmark to see what this program should do.
Microsoft (R) F# 3.0 Compiler version (Mono build)
Mono JIT compiler version 3.0.3 (tarball Tue Feb 12 10:56:44 PST 2013)
LLVM: yes(3.2svn-mono)
// The Computer Language Benchmarks Game // http://benchmarksgame.alioth.debian.org/ // // Modified version of Valentin Kraevskiy // Contributed by Vassil Keremidchiev open System.Text.RegularExpressions open System.Threading let regex s = Regex (s, RegexOptions.Compiled) let input = stdin.ReadToEnd () let withoutComments = (regex ">.*\n").Replace (input, "") let text = (regex "\n").Replace (withoutComments, "") let textSize = text.Length let blockSize = textSize / 2 let onblocks overlapSize blockSize = let rec onblocks' res = function | "" -> res | s when s.Length <= blockSize -> res @ [s] | s -> onblocks' (res @ [s.Substring(0, blockSize)]) (s.Substring(blockSize - overlapSize)) onblocks' [] let onProcBlocks = onblocks 0 ((textSize / System.Environment.ProcessorCount) + 1) let DNAcodes = [ "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" ] // Calculate all chunks in parallel let chunksCounts = let chunkedMatch (matchStr:string) = text |> onblocks (matchStr.Length - 1) blockSize |> List.map (fun t -> async { return matchStr, ((regex matchStr).Matches t).Count }) DNAcodes |> List.collect chunkedMatch |> Async.Parallel |> Async.RunSynchronously // Gather result counts by summing them per DNA code DNAcodes |> List.map (fun key -> key, chunksCounts |> Array.fold (fun S (k,cnt) -> if k=key then S+cnt else S) 0) |> List.iter (fun (key, cnt) -> printfn "%s %i" key cnt) let lengthAfterReplace text = ["B", "(c|g|t)" "D", "(a|g|t)" "H", "(a|c|t)" "K", "(g|t)" "M", "(a|c)" "N", "(a|c|g|t)" "R", "(a|g)" "S", "(c|g)" "V", "(a|c|g)" "W", "(a|t)" "Y", "(c|t)"] |> List.fold (fun s (code, alt) -> (regex code).Replace (s, alt)) text |> String.length let replacedSize = text |> onProcBlocks |> List.map (fun chunk -> async { return lengthAfterReplace chunk } ) |> Async.Parallel |> Async.RunSynchronously |> Array.sum printf "\n%i\n%i\n%i\n" input.Length textSize replacedSize
Wed, 13 Feb 2013 02:06:09 GMT MAKE: mv regexdna.fsharp-3.fsharp regexdna.fsharp-3.fs /usr/local/bin/fsharpc --target:exe --platform:x86 -O -o regexdna.fsharp-3.fsharp_run.exe regexdna.fsharp-3.fs Microsoft (R) F# 3.0 Compiler version (Mono build) Copyright (c) Microsoft Corporation. All Rights Reserved. /home/dunham/benchmarksgame_onecore/regexdna/tmp/regexdna.fsharp-3.fs(7,1): warning FS0221: The declarations in this file will be placed in an implicit module 'Regexdna.fsharp-3' based on the file name 'regexdna.fsharp-3.fs'. However this is not a valid F# identifier, so the contents will not be accessible from other files. Consider renaming the file or adding a 'module' or 'namespace' declaration at the top of the file. rm regexdna.fsharp-3.fs 4.18s to complete and log all make actions COMMAND LINE: /usr/local/bin/mono --llvm regexdna.fsharp-3.fsharp_run.exe 0 < regexdna-input5000000.txt PROGRAM FAILED PROGRAM OUTPUT: agggtaaa|tttaccct 356 [cgt]gggtaaa|tttaccc[acg] 1250 a[act]ggtaaa|tttacc[agt]t 4252 ag[act]gtaaa|tttac[agt]ct 2894 agg[act]taaa|ttta[agt]cct 5435 aggg[acg]aaa|ttt[cgt]ccct 1537 agggt[cgt]aa|tt[acg]accct 1431 agggta[cgt]a|t[acg]taccct 1608 agggtaa[cgt]|[acg]ttaccct 2178 <premain>: CommandLine Error: Argument 'misched' defined more than once! <premain>: CommandLine Error: Argument 'print-machineinstrs' defined more than once! -simplifycfg: CommandLine Error: Argument 'misched' defined more than once! -simplifycfg: CommandLine Error: Argument 'print-machineinstrs' defined more than once! Unhandled Exception: OutOfMemoryException [ERROR] FATAL UNHANDLED EXCEPTION: System.OutOfMemoryException: Out of memory at (wrapper managed-to-native) object:__icall_wrapper_mono_string_alloc (intptr) at (wrapper alloc) object:Alloc (intptr,int) at System.Text.StringBuilder.InternalEnsureCapacity (Int32 size) [0x00000] in <filename unknown>:0 at System.Text.StringBuilder.Append (System.String value, Int32 startIndex, Int32 count) [0x00000] in <filename unknown>:0 at System.Text.RegularExpressions.BaseMachine.LTRReplace (System.Text.RegularExpressions.Regex regex, System.String input, System.Text.RegularExpressions.MatchAppendEvaluator evaluator, Int32 count, Int32 startat, Boolean needs_groups_or_captures) [0x00000] in <filename unknown>:0 at System.Text.RegularExpressions.BaseMachine.Replace (System.Text.RegularExpressions.Regex regex, System.String input, System.String replacement, Int32 count, Int32 startat) [0x00000] in <filename unknown>:0 at System.Text.RegularExpressions.Regex.Replace (System.String input, System.String replacement, Int32 count, Int32 startat) [0x00000] in <filename unknown>:0 at System.Text.RegularExpressions.Regex.Replace (System.String input, System.String replacement) [0x00000] in <filename unknown>:0 at Regexdna.fsharp-3+lengthAfterReplace@61.Invoke (System.String s, System.Tuple`2 tupledArg) [0x00000] in <filename unknown>:0 at Microsoft.FSharp.Collections.ListModule.loop@151-20[Tuple`2,String] (Microsoft.FSharp.Core.FSharpFunc`3 f, System.String s, Microsoft.FSharp.Collections.FSharpList`1 xs) [0x00000] in <filename unknown>:0 at Microsoft.FSharp.Collections.ListModule.Fold[Tuple`2,String] (Microsoft.FSharp.Core.FSharpFunc`2 folder, System.String state, Microsoft.FSharp.Collections.FSharpList`1 list) [0x00000] in <filename unknown>:0 at Regexdna.fsharp-3.lengthAfterReplace (System.String text) [0x00000] in <filename unknown>:0 at Regexdna.fsharp-3+replacedSize@66-1.Invoke (Microsoft.FSharp.Core.Unit unitVar) [0x00000] in <filename unknown>:0 at Microsoft.FSharp.Control.AsyncBuilderImpl+callA@778[System.Int32,Microsoft.FSharp.Core.Unit].Invoke (Microsoft.FSharp.Control.AsyncParams`1 args) [0x00000] in <filename unknown>:0