{"action":"created","issue":{"url":"https://api.github.com/repos/crypto-browserify/sha.js/issues/32","labels_url":"https://api.github.com/repos/crypto-browserify/sha.js/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/crypto-browserify/sha.js/issues/32/comments","events_url":"https://api.github.com/repos/crypto-browserify/sha.js/issues/32/events","html_url":"https://github.com/crypto-browserify/sha.js/pull/32","id":103614866,"number":32,"title":"inline Sigma functions","user":{"login":"dcousens","id":413395,"avatar_url":"https://avatars.githubusercontent.com/u/413395?v=3","gravatar_id":"","url":"https://api.github.com/users/dcousens","html_url":"https://github.com/dcousens","followers_url":"https://api.github.com/users/dcousens/followers","following_url":"https://api.github.com/users/dcousens/following{/other_user}","gists_url":"https://api.github.com/users/dcousens/gists{/gist_id}","starred_url":"https://api.github.com/users/dcousens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcousens/subscriptions","organizations_url":"https://api.github.com/users/dcousens/orgs","repos_url":"https://api.github.com/users/dcousens/repos","events_url":"https://api.github.com/users/dcousens/events{/privacy}","received_events_url":"https://api.github.com/users/dcousens/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/crypto-browserify/sha.js/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"dominictarr","id":259374,"avatar_url":"https://avatars.githubusercontent.com/u/259374?v=3","gravatar_id":"","url":"https://api.github.com/users/dominictarr","html_url":"https://github.com/dominictarr","followers_url":"https://api.github.com/users/dominictarr/followers","following_url":"https://api.github.com/users/dominictarr/following{/other_user}","gists_url":"https://api.github.com/users/dominictarr/gists{/gist_id}","starred_url":"https://api.github.com/users/dominictarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dominictarr/subscriptions","organizations_url":"https://api.github.com/users/dominictarr/orgs","repos_url":"https://api.github.com/users/dominictarr/repos","events_url":"https://api.github.com/users/dominictarr/events{/privacy}","received_events_url":"https://api.github.com/users/dominictarr/received_events","type":"User","site_admin":false},"milestone":null,"comments":11,"created_at":"2015-08-27T23:23:55Z","updated_at":"2015-09-14T08:40:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/crypto-browserify/sha.js/pulls/32","html_url":"https://github.com/crypto-browserify/sha.js/pull/32","diff_url":"https://github.com/crypto-browserify/sha.js/pull/32.diff","patch_url":"https://github.com/crypto-browserify/sha.js/pull/32.patch"},"body":"Before (SHA256)\r\n```\r\n40, 3162, 6513.72, 0.4854368932038835\r\n41, 3868, 6769, 0.5714285714285714\r\n42, 4732, 6719.44, 0.704225352112676\r\n43, 5788, 6771.96, 0.8547008547008547\r\n44, 7079, 6795.84, 1.0416666666666667\r\n45, 8660, 6841.4, 1.2658227848101267\r\n46, 10593, 6885.45, 1.5384615384615385\r\n47, 12957, 6867.21, 1.8867924528301887\r\n48, 15849, 6815.07, 2.3255813953488373\r\n49, 19387, 6785.45, 2.857142857142857\r\n50, 23714, 6742.21568627451, 3.5172413793103448\r\n51, 29007, 6892.752475247525, 4.208333333333333\r\n52, 35481, 6889.514563106796, 5.15\r\n53, 43401, 6875.40594059406, 6.3125\r\n54, 53088, 6833.108910891089, 7.769230769230769\r\n55, 64938, 6803.028571428571, 9.545454545454545\r\n56, 79433, 6808.542857142857, 11.666666666666666\r\n57, 97163, 6801.41, 14.285714285714286\r\n58, 118850, 6856.7307692307695, 17.333333333333332\r\n59, 145378, 6608.090909090909, 22\r\n60, 177828, 6905.941747572816, 25.75\r\n61, 217520, 6851.023622047244, 31.75\r\n62, 266073, 6881.198275862069, 38.666666666666664\r\n63, 325462, 6875.957746478874, 47.333333333333336\r\n64, 398107, 6805.247863247863, 58.5\r\n65, 486968, 6858.704225352113, 71\r\n66, 595662, 6618.466666666666, 90\r\n67, 728618, 6873.754716981132, 106\r\n68, 891251, 6855.776923076923, 130\r\n69, 1090184, 6899.898734177215, 158\r\n70, 1333521, 6873.819587628866, 194\r\n71, 1631173, 6740.384297520661, 242\r\n72, 1995262, 6786.60544217687, 294\r\n73, 2440619, 6874.98309859155, 355\r\n74, 2985383, 6831.54004576659, 437\r\n75, 3651741, 6890.077358490566, 530\r\n76, 4466836, 6850.9754601227, 652\r\n77, 5463865, 6872.786163522012, 795\r\n78, 6683439, 6883.0473738414, 971\r\n79, 8175230, 6801.356073211315, 1202\r\n80, 10000000, 6872.852233676976, 1455\r\n```\r\n\r\nAfter\r\n```\r\n40, 3162, 17232.9, 0.1834862385321101\r\n41, 3868, 17328.64, 0.22321428571428573\r\n42, 4732, 17319.12, 0.273224043715847\r\n43, 5788, 17421.88, 0.33222591362126247\r\n44, 7079, 17555.92, 0.4032258064516129\r\n45, 8660, 17493.2, 0.49504950495049505\r\n46, 10593, 17584.38, 0.6024096385542169\r\n47, 12957, 17103.24, 0.7575757575757576\r\n48, 15849, 17592.39, 0.9009009009009009\r\n49, 19387, 17642.17, 1.098901098901099\r\n50, 23714, 17785.5, 1.3333333333333333\r\n51, 29007, 17694.27, 1.639344262295082\r\n52, 35481, 17740.5, 2\r\n53, 43401, 17618.227722772277, 2.4634146341463414\r\n54, 53088, 17696, 3\r\n55, 64938, 17533.26, 3.7037037037037037\r\n56, 79433, 17132.607843137255, 4.636363636363637\r\n57, 97163, 17750.93269230769, 5.473684210526316\r\n58, 118850, 17650.9900990099, 6.733333333333333\r\n59, 145378, 17499.203703703704, 8.307692307692308\r\n60, 177828, 17782.8, 10\r\n61, 217520, 17797.090909090908, 12.222222222222221\r\n62, 266073, 17738.2, 15\r\n63, 325462, 17752.47272727273, 18.333333333333332\r\n64, 398107, 17772.633928571428, 22.4\r\n65, 486968, 17086.59649122807, 28.5\r\n66, 595662, 17692.930693069306, 33.666666666666664\r\n67, 728618, 17771.170731707316, 41\r\n68, 891251, 17648.534653465347, 50.5\r\n69, 1090184, 17726.56910569106, 61.5\r\n70, 1333521, 17780.28, 75\r\n71, 1631173, 17730.141304347828, 92\r\n72, 1995262, 17053.521367521367, 117\r\n73, 2440619, 17814.73722627737, 137\r\n74, 2985383, 17664.988165680472, 169\r\n75, 3651741, 17726.898058252427, 206\r\n76, 4466836, 17796.159362549803, 251\r\n77, 5463865, 17568.69774919614, 311\r\n78, 6683439, 17822.504, 375\r\n79, 8175230, 17810.958605664488, 459\r\n80, 10000000, 17730.49645390071, 564\r\n```\r\n\r\nLooking at 250% improvement in performance.\r\nProbably won't be consistent,  but,  I doubt there will ever be a performance *loss* given the simplicity of the change."},"comment":{"url":"https://api.github.com/repos/crypto-browserify/sha.js/issues/comments/140001652","html_url":"https://github.com/crypto-browserify/sha.js/pull/32#issuecomment-140001652","issue_url":"https://api.github.com/repos/crypto-browserify/sha.js/issues/32","id":140001652,"user":{"login":"dcousens","id":413395,"avatar_url":"https://avatars.githubusercontent.com/u/413395?v=3","gravatar_id":"","url":"https://api.github.com/users/dcousens","html_url":"https://github.com/dcousens","followers_url":"https://api.github.com/users/dcousens/followers","following_url":"https://api.github.com/users/dcousens/following{/other_user}","gists_url":"https://api.github.com/users/dcousens/gists{/gist_id}","starred_url":"https://api.github.com/users/dcousens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcousens/subscriptions","organizations_url":"https://api.github.com/users/dcousens/orgs","repos_url":"https://api.github.com/users/dcousens/repos","events_url":"https://api.github.com/users/dcousens/events{/privacy}","received_events_url":"https://api.github.com/users/dcousens/received_events","type":"User","site_admin":false},"created_at":"2015-09-14T08:40:34Z","updated_at":"2015-09-14T08:40:34Z","body":"``` bash\r\nnode -v\r\n  v0.12.7\r\n\r\ngit clone https://github.com/crypto-browserify/sha.js\r\ngit clone https://github.com/dominictarr/crypto-bench\r\ncd sha.js\r\nnpm install\r\nnpm link\r\ncd ../crypto-bench\r\nnpm install\r\nnpm link sha.js\r\nnode bench-hash sha.js sha256 > before.log\r\ncd ../sha.js\r\ngit checkout perf\r\ncd ../crypto-bench\r\nnode bench-hash sha.js sha256 > after.log\r\n```\r\n\r\nbefore.log\r\n``` \r\nrun (N), input-size (bytes), ops (bytes/ms), time (ms)\r\nrun (N), input-size (bytes), ops (bytes/ms), time (ms)\r\n1, 1, 69.04, 0.014484356894553883\r\n3, 2, 166.7, 0.01199760047990402\r\n5, 3, 259.23, 0.011572734637194769\r\n7, 4, 349.92, 0.011431184270690443\r\n8, 5, 427.65, 0.0116918040453642\r\n9, 6, 528.6, 0.011350737797956867\r\n10, 7, 616.56, 0.011353315168029064\r\n11, 9, 793.17, 0.01134687393623057\r\n12, 11, 965.69, 0.011390818999886091\r\n13, 14, 1234.52, 0.011340440009072352\r\n14, 17, 1454.01, 0.0116918040453642\r\n15, 21, 1844.01, 0.011388224575788634\r\n16, 25, 2192.75, 0.011401208528103978\r\n17, 31, 2729.86, 0.011355893708834885\r\n18, 38, 3337.54, 0.011385631333257429\r\n19, 46, 4042.48, 0.01137915339098771\r\n20, 56, 2653.28, 0.021105951878429716\r\n21, 69, 3307.17, 0.020863759649488837\r\n22, 84, 4026.12, 0.020863759649488837\r\n23, 103, 4764.78, 0.021616947686986597\r\n24, 126, 4147.92, 0.030376670716889428\r\n25, 154, 5055.82, 0.03045994517209869\r\n26, 188, 4700, 0.04\r\n27, 230, 5750, 0.04\r\n28, 282, 5704.86, 0.049431537320810674\r\n29, 345, 5847.75, 0.058997050147492625\r\n30, 422, 6178.08, 0.06830601092896176\r\n31, 516, 5913.36, 0.08726003490401396\r\n32, 631, 6278.45, 0.10050251256281408\r\n33, 772, 6160.56, 0.12531328320802004\r\n34, 944, 6523.04, 0.1447178002894356\r\n35, 1155, 6329.4, 0.18248175182481752\r\n36, 1413, 6386.76, 0.22123893805309736\r\n37, 1728, 6445.44, 0.2680965147453083\r\n38, 2113, 6486.91, 0.3257328990228013\r\n39, 2585, 6617.6, 0.390625\r\n40, 3162, 6608.58, 0.4784688995215311\r\n41, 3868, 6575.6, 0.5882352941176471\r\n42, 4732, 6530.16, 0.7246376811594203\r\n43, 5788, 6656.2, 0.8695652173913043\r\n44, 7079, 6725.05, 1.0526315789473684\r\n45, 8660, 6754.8, 1.2820512820512822\r\n46, 10593, 6673.59, 1.5873015873015872\r\n47, 12957, 6737.64, 1.9230769230769231\r\n48, 15849, 6747.59405940594, 2.3488372093023258\r\n49, 19387, 6718.267326732674, 2.8857142857142857\r\n50, 23714, 6676.757281553398, 3.5517241379310347\r\n51, 29007, 6540.794117647059, 4.434782608695652\r\n52, 35481, 6758.285714285715, 5.25\r\n53, 43401, 6741.902912621359, 6.4375\r\n54, 53088, 6700.42718446602, 7.923076923076923\r\n55, 64938, 6738.8490566037735, 9.636363636363637\r\n56, 79433, 6744.311320754717, 11.777777777777779\r\n57, 97163, 6734.069306930693, 14.428571428571429\r\n58, 118850, 6791.428571428572, 17.5\r\n59, 145378, 6793.3644859813085, 21.4\r\n60, 177828, 6586.222222222223, 27\r\n61, 217520, 6692.923076923077, 32.5\r\n62, 266073, 6764.567796610169, 39.333333333333336\r\n63, 325462, 6733.696551724138, 48.333333333333336\r\n64, 398107, 6747.576271186441, 59\r\n65, 486968, 6716.8, 72.5\r\n66, 595662, 6768.886363636364, 88\r\n67, 728618, 6564.126126126126, 111\r\n68, 891251, 6751.901515151515, 132\r\n69, 1090184, 6771.329192546584, 161\r\n70, 1333521, 6734.954545454545, 198\r\n71, 1631173, 6768.352697095435, 241\r\n72, 1995262, 6650.873333333333, 300\r\n73, 2440619, 6779.497222222222, 360\r\n74, 2985383, 6754.260180995475, 442\r\n75, 3651741, 6737.529520295203, 542\r\n76, 4466836, 6747.486404833837, 662\r\n77, 5463865, 6795.851990049751, 804\r\n78, 6683439, 6730.552870090634, 993\r\n79, 8175230, 6728.584362139918, 1215\r\n80, 10000000, 6765.899864682003, 1478\r\n```\r\n\r\nafter.log\r\n```\r\nrun (N), input-size (bytes), ops (bytes/ms), time (ms)\r\n1, 1, 148.89, 0.0067163677883000875\r\n3, 2, 365.46, 0.005472555135992995\r\n5, 3, 543.63, 0.005518459246178467\r\n7, 4, 748.64, 0.005343022013250694\r\n8, 5, 894.4, 0.005590339892665474\r\n9, 6, 1118.94, 0.005362217813287576\r\n10, 7, 1307.04, 0.005355612682090831\r\n11, 9, 1675.62, 0.005371146202599634\r\n12, 11, 2053.59, 0.005356473297980609\r\n13, 14, 2608.62, 0.005366822304513497\r\n14, 17, 3164.38, 0.0053723004190394325\r\n15, 21, 3910.2, 0.0053705692803437165\r\n16, 25, 4632, 0.005397236614853195\r\n17, 31, 5697.8, 0.00544069640914037\r\n18, 38, 6458.86, 0.005883391186680002\r\n19, 46, 8418.92, 0.005463883728554256\r\n20, 56, 6208.16, 0.009020386072523904\r\n21, 69, 7639.68, 0.009031791907514452\r\n22, 84, 9262.68, 0.009068649678062937\r\n23, 103, 11386.65, 0.009045680687471733\r\n24, 126, 9948.96, 0.012664640324214792\r\n25, 154, 12136.74, 0.01268874508311128\r\n26, 188, 11595.84, 0.01621271076523995\r\n27, 230, 13542.4, 0.016983695652173912\r\n28, 282, 14119.74, 0.019972039145196723\r\n29, 345, 14638.35, 0.023568230025925053\r\n30, 422, 15487.4, 0.027247956403269755\r\n31, 516, 15000.12, 0.03439972480220158\r\n32, 631, 16595.3, 0.03802281368821293\r\n33, 772, 15818.28, 0.04880429477794046\r\n34, 944, 16822.08, 0.05611672278338945\r\n35, 1155, 16481.85, 0.0700770847932726\r\n36, 1413, 15952.77, 0.08857395925597875\r\n37, 1728, 16778.88, 0.10298661174047374\r\n38, 2113, 16925.13, 0.12484394506866417\r\n39, 2585, 17319.5, 0.14925373134328357\r\n40, 3162, 17359.38, 0.18214936247723132\r\n41, 3868, 17406, 0.2222222222222222\r\n42, 4732, 17082.52, 0.2770083102493075\r\n43, 5788, 17479.76, 0.33112582781456956\r\n44, 7079, 17626.71, 0.40160642570281124\r\n45, 8660, 17320, 0.5\r\n46, 10593, 17584.38, 0.6024096385542169\r\n47, 12957, 17232.81, 0.7518796992481203\r\n48, 15849, 17750.88, 0.8928571428571429\r\n49, 19387, 17659.445544554455, 1.0978260869565217\r\n50, 23714, 17785.5, 1.3333333333333333\r\n51, 29007, 17694.27, 1.639344262295082\r\n52, 35481, 17916.148514851484, 1.9803921568627452\r\n53, 43401, 17794.41, 2.4390243902439024\r\n54, 53088, 17696, 3\r\n55, 64938, 17189.470588235294, 3.7777777777777777\r\n56, 79433, 17737.466019417476, 4.478260869565218\r\n57, 97163, 17750.93269230769, 5.473684210526316\r\n58, 118850, 17827.5, 6.666666666666667\r\n59, 145378, 17829.377358490565, 8.153846153846153\r\n60, 177828, 17782.8, 10\r\n61, 217520, 17797.090909090908, 12.222222222222221\r\n62, 266073, 17738.2, 15\r\n63, 325462, 17915.339449541283, 18.166666666666668\r\n64, 398107, 17460.833333333332, 22.8\r\n65, 486968, 17870.38532110092, 27.25\r\n66, 595662, 17869.86, 33.333333333333336\r\n67, 728618, 17916.83606557377, 40.666666666666664\r\n68, 891251, 17825.02, 50\r\n69, 1090184, 17871.868852459018, 61\r\n70, 1333521, 17899.610738255033, 74.5\r\n71, 1631173, 17539.494623655915, 93\r\n72, 1995262, 17975.333333333332, 111\r\n73, 2440619, 17814.73722627737, 137\r\n74, 2985383, 17876.54491017964, 167\r\n75, 3651741, 17900.691176470587, 204\r\n76, 4466836, 17939.100401606425, 249\r\n77, 5463865, 17739.821428571428, 308\r\n78, 6683439, 18014.66037735849, 371\r\n79, 8175230, 17810.958605664488, 459\r\n80, 10000000, 17889.08765652952, 559\r\n```"}}