Bug 449371 Firefox/Thunderbird crashes at exit [@ gdk_display_x11_finalize], p=Brian...
[wine-gecko.git] / testing / performance / talos / page_load_test / jss / real-fasta-8.html
blob998d1debb7d15291acc1ad6dd2b3fa256cc1c5c1
1 <html><head>
2 <!-- MOZ_INSERT_CONTENT_HOOK -->
3 <script src = runner.js></script>
4 <script>
5 var onlyName = 'IUB ambiguity codes', onlyNum = 8;
6 function thisTest() {
8 // The Great Computer Language Shootout
9 // http://shootout.alioth.debian.org
11 // Contributed by Ian Osgood
13 var last = 42, A = 3877, C = 29573, M = 139968;
15 function rand(max) {
16 last = (last * A + C) % M;
17 return max * last / M;
20 var ALU =
21 "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG" +
22 "GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA" +
23 "CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT" +
24 "ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA" +
25 "GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" +
26 "AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" +
27 "AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA";
29 var IUB = {
30 a:0.27, c:0.12, g:0.12, t:0.27,
31 B:0.02, D:0.02, H:0.02, K:0.02,
32 M:0.02, N:0.02, R:0.02, S:0.02,
33 V:0.02, W:0.02, Y:0.02
36 var HomoSap = {
37 a: 0.3029549426680,
38 c: 0.1979883004921,
39 g: 0.1975473066391,
40 t: 0.3015094502008
43 function makeCumulative(table) {
44 var last = null;
45 for (var c in table) {
46 if (last) table[c] += table[last];
47 last = c;
51 function fastaRepeat(n, seq) {
52 var seqi = 0, lenOut = 60;
53 while (n>0) {
54 if (n<lenOut) lenOut = n;
55 if (seqi + lenOut < seq.length) {
56 ret = seq.substring(seqi, seqi+lenOut);
57 seqi += lenOut;
58 } else {
59 var s = seq.substring(seqi);
60 seqi = lenOut - s.length;
61 ret = s + seq.substring(0, seqi);
63 n -= lenOut;
67 function fastaRandom(n, table) {
68 var line = new Array(60);
69 makeCumulative(table);
70 while (n>0) {
71 if (n<line.length) line = new Array(n);
72 for (var i=0; i<line.length; i++) {
73 var r = rand(1);
74 for (var c in table) {
75 if (r < table[c]) {
76 line[i] = c;
77 break;
81 ret = line.join('');
82 n -= line.length;
86 startTest("real-fasta");
88 var ret;
90 for ( var n = 2; n <= 16; n *= 2 ) (function(n){
91 test( "Homo sapiens alu", n, function(){
92 ret = fastaRepeat(2*n*100000, ALU);
93 });
95 test( "IUB ambiguity codes", n, function(){
96 ret = fastaRandom(3*n*1000, IUB);
97 });
99 test( "Homo sapiens frequenc", n, function(){
100 ret = fastaRandom(5*n*1000, HomoSap);
102 })(n);
104 endTest();
106 </script>
107 <body onload="thisTest()"></body></html>