/mobile Handheld Friendly website

 performance measurements

Each table row shows performance measurements for this Smalltalk VisualWorks program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
50,0003.403.4424,596584  0% 0% 0% 100%
500,00032.0932.1462,084584  0% 1% 0% 100%
5,000,000321.34321.47376,248584  0% 0% 0% 100%

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.

 notes

VisualWorks® Personal Use Edition Release 7.9 of May 11, 2012

 regex-dna Smalltalk VisualWorks program source code

"* The Computer Language Benchmarks Game
    http://benchmarksgame.alioth.debian.org/
    contributed by Eliot Miranda *"!


!Tests class methodsFor: 'benchmarking'!
matchPatterns
   ^#(   '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'
   )! !

!Tests class methodsFor: 'benchmarking'!
substitutionPatterns
   ^#(   #('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)'))! !


!Tests class methodsFor: 'benchmarking'!
regexDNA: sequence to: output
   | s size1 size2 translation |
   size1 := sequence size.

   "* remove FASTA sequence descriptions and new-lines *"
   s := sequence copyWithRegex: '>[^\r]*\r|\r' matchesReplacedWith: ''.
   size2 := s size.

   "* regex match *"
   self matchPatterns do: [:each| 
      output 
         nextPutAll: each; space; 
         print: (s occurrencesOfRegex: each); nl
      ]. 

   "* regex substitution *"
   translation := Dictionary new.
   self substitutionPatterns do: [:each| 
      translation at: each first put: each last].

   s := s copyWithRegex: '[', 
         (translation keys asArray fold: [:a :b| a, b]), ']'
      matchesTranslatedUsing: [:l| translation at: l].

   output
      nl;
      print: size1; nl; 
      print: size2; nl; 
      print: s size; nl! !


!Tests class methodsFor: 'benchmark scripts'!
regexdna
   self regexDNA: self stdinSpecial contents to: self stdout.
   ^'' ! !

 make, command-line, and program output logs

Thu, 07 Feb 2013 00:33:07 GMT

COMMAND LINE:
/usr/local/src/vw7.9pul/bin/linux86/vwlinux86 /usr/local/src/vw7.9pul/image/benchmarks.im -nogui -evaluate "Tests regexdna" -a 0 < regexdna-input5000000.txt

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

50833411
50000000
66800214

Revised BSD license

  Home   Conclusions   License   Play