Last active
January 27, 2021 00:11
-
-
Save shu1/28a1136f1fd79ceea52ffa72a302382e to your computer and use it in GitHub Desktop.
burrows-wheeler vs shu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"title":"burrows-wheeler vs shu","initialization":"var output = \"endrtednedd:/os....cp.rnnn.rhhps/.tt|sfeaiaaofd.ow.otooapa.asu./thhse\";","setup":"var col = output.split('');","tests":[{"name":"burrows-wheeler","code":"var table = output.split('');\nfor (var j = output.length; j > 1; --j) {\n\ttable.sort();\n\tfor (var i = table.length-1; i >= 0; --i) {\n\t\ttable[i] = col[i] + table[i];\n\t}\n}","results":{"aborted":false,"count":75,"cycles":2,"hz":637.3545169037501,"stats":{"moe":0.000007622545676816873,"rme":0.48582639174243863,"sem":0.000003889053916743303,"deviation":0.00002637684698551886,"mean":0.0015689855072463772,"variance":6.957380568974753e-10,"numSamples":46},"times":{"cycle":0.1176739130434783,"elapsed":5.936,"period":0.0015689855072463772,"timeStamp":1611677282847}},"platforms":{"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15":{"aborted":false,"count":148,"cycles":5,"hz":1820.4881798962142,"stats":{"moe":0.000004762145801043084,"rme":0.8669430141741322,"sem":0.0000024296662250219813,"deviation":0.00001943732980017585,"mean":0.0005493032094594593,"variance":3.778097897608042e-10,"numSamples":64},"times":{"cycle":0.08129687499999998,"elapsed":7.177,"period":0.0005493032094594593,"timeStamp":1611676959324}},"Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36":{"aborted":false,"count":81,"cycles":4,"hz":1055.4259043173868,"stats":{"moe":0.0000025390208097696173,"rme":0.2679748334231762,"sem":0.0000012954187804947027,"deviation":0.000010603459705657943,"mean":0.0009474847982310664,"variance":1.1243335772951162e-10,"numSamples":67},"times":{"cycle":0.07674626865671638,"elapsed":6.03,"period":0.0009474847982310664,"timeStamp":1611677096744}},"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36":{"aborted":false,"count":75,"cycles":2,"hz":637.3545169037501,"stats":{"moe":0.000007622545676816873,"rme":0.48582639174243863,"sem":0.000003889053916743303,"deviation":0.00002637684698551886,"mean":0.0015689855072463772,"variance":6.957380568974753e-10,"numSamples":46},"times":{"cycle":0.1176739130434783,"elapsed":5.936,"period":0.0015689855072463772,"timeStamp":1611677282847}}}},{"name":"shu","code":"col.sort();\nvar table = output.split('');\nfor (var i = table.length-1; i >= 0; --i) {\n\ttable[i] += col[i];\n}\n\nvar used = Array(table.length);\nfor (var i=1; i < output.length-1; ++i) {\n\tused.fill(false);\n\tfor (var j=0; j < table.length; ++j) {\n\t\tfor (var k=0; k < table.length; ++k) {\n\t\t\tmatch:\n\t\t\tif (!used[k]) {\n\t\t\t\tfor (var l=0; l < i; ++l) {\n\t\t\t\t\tif (table[k][l] != table[j][l+1]) {\n\t\t\t\t\t\tbreak match;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttable[j] += table[k][i];\n\t\t\t\tused[k] = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}","results":{"aborted":false,"count":33,"cycles":4,"hz":415.7597358489687,"stats":{"moe":0.000012000430651806979,"rme":0.4989295877869137,"sem":0.00000612266869990152,"deviation":0.00004742598781812801,"mean":0.002405235316878462,"variance":2.2492243205252262e-9,"numSamples":60},"times":{"cycle":0.07937276545698925,"elapsed":5.99,"period":0.002405235316878462,"timeStamp":1611677288790}},"platforms":{"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15":{"aborted":false,"count":82,"cycles":6,"hz":1057.733810272718,"stats":{"moe":0.0000051465380043243696,"rme":0.5443667253027366,"sem":0.000002625784696083862,"deviation":0.000021169753011365867,"mean":0.0009454174484052538,"variance":4.4815844256223425e-10,"numSamples":65},"times":{"cycle":0.07752423076923082,"elapsed":6.504,"period":0.0009454174484052538,"timeStamp":1611676966508}},"Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36":{"aborted":false,"count":39,"cycles":5,"hz":510.84731887024105,"stats":{"moe":0.000004220626385327252,"rme":0.21560956728974237,"sem":0.000002153380808840435,"deviation":0.00001722704647072348,"mean":0.001957532051282053,"variance":2.9677113010446626e-10,"numSamples":64},"times":{"cycle":0.07634375000000007,"elapsed":6.012,"period":0.001957532051282053,"timeStamp":1611677102780}},"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36":{"aborted":false,"count":33,"cycles":4,"hz":415.7597358489687,"stats":{"moe":0.000012000430651806979,"rme":0.4989295877869137,"sem":0.00000612266869990152,"deviation":0.00004742598781812801,"mean":0.002405235316878462,"variance":2.2492243205252262e-9,"numSamples":60},"times":{"cycle":0.07937276545698925,"elapsed":5.99,"period":0.002405235316878462,"timeStamp":1611677288790}}}}]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment