-
Notifications
You must be signed in to change notification settings - Fork 0
/
lzstring_bench_test.go
21 lines (16 loc) · 13.6 KB
/
lzstring_bench_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package lzstring
import "testing"
const benchString = "dTphYcMTZ1c2rVbnYXGxcUHqNm8KKdnzlWoEzxHzYzZAHGLse9RGcW9em0QhuxMO25X9DrNljuiKzMDBGYvBBV9GZaWFHwUEBkonRLbHU9fidCdivYHYTGVAYlQpA6jV9oySk7q4qbyOoZnfJxOcribe5bwx0ReONvEIZHVz15NYAY2I9zTDhVNfDm2AKHlTZa8RdbQD3rrekSidy918hrQq9QQKvSQPyTU3jUvaVzE1zp63SqW3CBDSyvMpWbh1iiGBXvZjQCiufDebd3ko6HRcNL0O7Bh69ZOcAJGlYPxtxWTOuhpRSwnTym6kVklRF8DomOVyQvmJEiBaVqnXgbvoMXf034YCUmW1HLyp5zuWmQHCSEaJqFFoxwIq1QCUuz8SGYlv07MviQ5PfrM58uLAaM1EOl2euCk8AdiZpMGHEi2VFWeIh0off7qyIBOKihfy6FoLbAPXrQtHOTfCeFeldnaGN36bEZHM11oTX6X8ZU2QfChj4wfRZMCGNsIxFnJBjcHdEIhT74oXPcg8NGjwR6sSc7NUY1iKKACJK6TcPFWz2TqKUD3UAIXUjBv19sTymWMlUOLhee9FaNJQF2zWlDYN4sffpcBgJpgF4LJwOpqoAJfX6lCXPvjLHtW93AaupQ0khenMnTxfhvuVEsKx88OVYkyuzGfXo29U39HwpIby4mG3szV4LESl9VqmeZe8UOWJWr16MD3WK51jlJv2LVYguj7x0AezY26m7JtO5CDGfbRo2C9x2mXtB8Fz3W8ykxyet586WT0vTPXXQIJRGw1dNYHfdjE9i4O841ZIdQkXYeoxiZrHrw3AtOTHYIjLnMojVx0UcjkyFsHOOVNRsaXmEStadxg65fXicBX4RqD7pciik1WwrKVeyRos34djzwVV9fzqUTBea930TVjRiD4Evlea0pqrPkhdQzSHRoV5kBwX7LU3CuaLnuMy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w8iEizF30VE3c01LF68YMoxYKtyuPKu6ZKsX0CCCgGKkaW2ZLNgz5LF094Gq6LZmnPZUSzDrfyFF3Ln8VKUgOe4gKs2Yh0F71rjWYaJUyLcvYUdSwHhImibzrL1NraZBMZS0Ed2g5ZdvyIxWdIYJ6zqvHR8rBSxQrTFei3N3wkUXkQNtoY10MzRqp1Zfhp9mKKkTZ1c4WYC2eZv5pA0OwH2mREqv0SfEDfPPjen6ZqMvURGlShhpWEzPWcE8T2NWdHkIr3lIS1A3OHgley2u9iMvPmqt7hegPIDJPuYZ7jHVbKaH2JSsxRzx4AtOxtA1rCsmClvbATOEimVMT5Zlq9kTmmSadD4wYUchWaa8KLerGE3LA3fP9Zh7FQxiKIY2tXa4JGjJzGyNpw64V0eV93eaCPO8GF6NodYCEv5YjVuVxrzeHRzQBRg7TuViYDKNjqG8iahxzzJYvYPcuYQEcoyFhmegOs5A8rpIXJC0dxKE8uQx2GMd2pBMtRmuSwlUwBjbgJU8MH5TNIU3Vm7RPDzfWsNAhzvdtAG2Giy5mRbUpM4Wr3bQ9KU0VgO7mmYSrFfxufwlJhO3QfbP69kLlIOzVFGEH9YCmNUAjZVdEtaV7CwbTc8Il5s0bUpXeCZDq03cGNDcqO0ZBmrEkg1TjCLRBH3X5LjUmm8nckTvXD6WaJdRQl61y3ZoKLajLlJONKjEXSPBrxZw5CUSg8OnaVWmeOd6EFQf0Z6vBS1XD2htiTOgkJntca4qMJIDQ1zjZQOzufViWDSUGBi4hTs8KuaHhavJy4XZP7ufZghINFr7hUUmyGrbfh0twTa1sUF81eCKXxOiLmwIQC0kN8i6D3YTJgpXtJFyvehc2oeK30rUoF9wgeO6pnSfWUrGOF3HcF1DpfHphODL3PygiaPLUraeTZ6MIKmyj8wzearZD6XCsWd22nYr"
var benchCompressed = []uint16{2433, 20494, 352, 39436, 24754, 8214, 33048, 24614, 312, 3392, 17923, 45696, 3329, 50176, 61824, 21760, 9220, 28686, 16475, 56, 1681, 30780, 752, 1728, 29953, 60418, 35445, 9555, 37966, 34818, 2390, 8198, 16435, 32851, 156, 149, 35013, 58025, 17152, 3073, 5152, 1397, 9984, 15514, 172, 33876, 272, 51035, 32811, 25345, 11354, 29575, 24592, 45352, 110, 15934, 22570, 50312, 134, 48128, 25172, 238, 5250, 15872, 55036, 30826, 29240, 21524, 10752, 26222, 49152, 49856, 28161, 20564, 20512, 50264, 21072, 56326, 24658, 108, 52897, 64512, 40448, 51913, 236, 13312, 11316, 14573, 59132, 34936, 47360, 21156, 58928, 6254, 14410, 22072, 29092, 31338, 19174, 29697, 33280, 37512, 21592, 40136, 22132, 20661, 26811, 10908, 8310, 4184, 29881, 30220, 26706, 11348, 56392, 4428, 27328, 14342, 30208, 13062, 772, 42570, 29706, 60693, 12809, 33024, 49176, 26666, 769, 34176, 5352, 6144, 2797, 4101, 4124, 57504, 1058, 18241, 12819, 34306, 27139, 14900, 24096, 12451, 58290, 30170, 312, 6167, 33664, 33568, 56430, 25103, 36992, 5187, 14348, 34103, 12681, 58529, 49921, 425, 9877, 3395, 929, 51444, 58910, 36738, 1233, 21025, 26194, 18865, 7045, 198, 36864, 11940, 24072, 7372, 24705, 32980, 40248, 40452, 3792, 24885, 37464, 25783, 3405, 4705, 55800, 3187, 5661, 41056, 2097, 9858, 14095, 34963, 17346, 4096, 58936, 191, 3592, 17865, 59649, 64808, 8514, 32965, 58144, 43122, 30360, 2761, 50738, 61464, 1578, 8531, 43040, 35404, 26833, 26815, 5255, 5592, 53648, 17034, 12691, 33988, 60409, 47105, 15631, 19968, 4976, 6316, 6364, 34318, 1378, 25368, 58450, 2204, 6408, 10035, 28880, 19043, 8537, 9410, 37013, 4192, 14385, 2690, 6977, 24994, 48165, 11970, 1959, 58085, 29309, 30382, 51150, 24929, 47136, 47478, 37710, 47506, 36963, 2288, 50005, 7362, 740, 34066, 36113, 10460, 1793, 4880, 29728, 9424, 57474, 463, 15136, 64520, 2113, 13444, 4872, 32848, 26625, 33796, 16590, 16199, 4836, 27170, 1794, 5200, 17035, 45712, 53534, 2352, 63694, 3077, 17152, 31492, 512, 62717, 16136, 16482, 12308, 25793, 53444, 13191, 4520, 19714, 35280, 49213, 7425, 16704, 40091, 1314, 5267, 2820, 53376, 12294, 8826, 28776, 2051, 16560, 5136, 8513, 18619, 8449, 17208, 15872, 19584, 43018, 15785, 39360, 56325, 3681, 51216, 4746, 41796, 4381, 2352, 6353, 6665, 49904, 56349, 34049, 53501, 653, 31104, 12303, 34074, 19552, 5229, 5108, 29220, 50963, 39008, 3343, 50026, 47402, 7618, 5276, 16460, 57800, 21537, 44450, 691, 45446, 24, 31282, 20325, 57456, 7594, 17124, 4096, 19553, 24706, 642, 49808, 19475, 3049, 16585, 15182, 56080, 51583, 1664, 43192, 35471, 4480, 47920, 53200, 12484, 8224, 41584, 22548, 22562, 29916, 2693, 32976, 3090, 34945, 10316, 3483, 49740, 48134, 3201, 13534, 8235, 49328, 22066, 3299, 28819, 70, 33224, 22548, 1307, 6350, 3910, 45384, 19000, 34433, 13324, 3913, 12826, 58901, 34897, 55389, 19974, 41205, 34058, 35393, 40972, 8456, 26872, 19508, 18880, 7500, 15180, 37520, 60690, 34922, 20045, 10663, 40964, 8247, 59456, 6331, 9409, 41412, 51248, 1649, 20665, 12300, 57864, 10779, 36819, 38988, 16204, 33312, 47920, 99, 9348, 5124, 41942, 28194, 385, 20504, 7239, 38269, 8197, 19378, 25957, 32522, 53676, 5132, 3299, 46545, 655, 64250, 29722, 32928, 17540, 779, 13850, 4400, 2625, 17997, 5516, 38328, 49505, 4049, 43060, 7555, 53509, 23730, 19586, 61553, 1538, 49504, 19003, 18444, 10281, 34105, 49604, 22568, 19346, 28724, 1282, 248, 18948, 17058, 634, 2053, 33592, 27163, 34659, 62594, 77, 49927, 31292, 20864, 25125, 19257, 49780, 45759, 1409, 22729, 3975, 4624, 15644, 35722, 5318, 1095, 8672, 50716, 3795, 8236, 8520, 26722, 28187, 57739, 14570, 12964, 54002, 57939, 53632, 16516, 7685, 33256, 5146, 34824, 49274, 199, 33248, 6168, 704, 6397, 2692, 26132, 55970, 898, 36949, 40996, 49396, 20881, 59202, 56505, 120, 33604, 50199, 17689, 43092, 5251, 54040, 30753, 19587, 6186, 6158, 24824, 21522, 34595, 52768, 10049, 16592, 33842, 2995, 38913, 6234, 16508, 8517, 51409, 3307, 17434, 977, 3350, 17696, 11295, 41286, 15819, 36232, 7686, 28673, 3073, 64098, 393, 36890, 754, 22553, 248, 16646, 3185, 10869, 51224, 36162, 19564, 35264, 28687, 34162, 21518, 50072, 15623, 220, 40816, 49309, 7947, 9319, 1312, 26657, 41568, 25810, 24965, 10435, 57380, 772, 10352, 3907, 4932, 1888, 56340, 26184, 47891, 41184, 15117, 30883, 14082, 24678, 33282, 5177, 1376, 41746, 33440, 41474, 472, 15215, 3308, 1281, 65144, 2627, 62523, 2352, 12332, 688, 64582, 33536, 5640, 16416, 7949, 47730, 769, 55361, 1877, 28799, 1608, 4353, 33232, 14085, 24803, 34816, 35048, 38785, 19500, 1305, 52287, 17072, 60695, 8944, 10446, 13578, 3344, 36533, 22307, 14352, 1808, 57892, 3528, 19473, 54128, 14472, 4420, 33412, 34346, 1064, 20597, 25880, 58537, 26, 19729, 244, 26368, 49267, 44802, 49264, 226, 60480, 16899, 37387, 1256, 24592, 41286, 22689, 45090, 16192, 49404, 3617, 27453, 1028, 58388, 50228, 34436, 224, 3137, 34920, 6784, 33020, 544, 25108, 51040, 53296, 1536, 35018, 32836, 6657, 328, 1031, 59393, 7586, 8207, 6661, 34716, 1496, 279, 25473, 27202, 49612, 1091, 49162, 3523, 61513, 36064, 5169, 1974, 40193, 16840, 5637, 8428, 1572, 13566, 50563, 4114, 53184, 8200, 11008, 23699, 41058, 15112, 26626, 11842, 49258, 6787, 10248, 4076, 51980, 912, 19456, 49449, 4999, 24672, 15265, 59485, 8097, 18482, 2129, 30750, 1370, 34570, 32945, 32257, 34840, 10498, 20596, 1985, 51321, 1665, 63551, 17920, 15632, 4432, 10304, 41336, 8608, 32896, 36546, 25180, 34048, 54329, 33184, 47375, 48, 21735, 96, 10497, 59416, 34583, 46108, 1571, 284, 17280, 19713, 53450, 36876, 57744, 68, 11837, 5027, 17208, 34113, 41501, 34304, 56336, 17264, 29440, 24600, 7300, 61994, 3712, 45822, 34528, 16411, 33596, 5145, 9004, 57346, 29713, 13379, 41008, 2464, 17446, 34016, 62492, 17000, 35081, 16972, 14853, 24672, 11974, 12634, 19136, 63536, 1184, 53313, 34761, 56882, 25265, 134, 25352, 5252, 57581, 2753, 10306, 993, 55835, 33184, 15873, 33096, 29448, 9416, 7809, 20582, 15729, 10266, 1377, 47143, 9120, 2698, 43464, 28165, 33163, 47116, 37487, 194, 29774, 673, 30746, 24704, 47887, 15306, 51593, 49392, 5380, 54459, 2609, 25932, 40032, 4684, 664, 8728, 49291, 9729, 4108, 5429, 30077, 6435, 9275, 1216, 50985, 37840, 29719, 25324, 10241, 4260, 12865, 49309, 35, 4169, 34592, 53305, 33457, 47896, 10008, 2568, 26816, 7814, 28772, 6336, 23291, 1953, 47153, 160, 34832, 53762, 8101, 6232, 36676, 57492, 22469, 57426, 6016, 3125, 54304, 63395, 4628, 19286, 41152, 16192, 50234, 13185, 18012, 34977, 1087, 1028, 11284, 22069, 11270, 32995, 7170, 36918, 2568, 12566, 9536, 62500, 50632, 38569, 41792, 30984, 64977, 5404, 3808, 34800, 20488, 33664, 3460, 16616, 9730, 8664, 1294, 24596, 8452, 59434, 1524, 57374, 35328, 3084, 83, 60703, 41784, 10755, 53755, 7172, 13445, 1024, 32774, 2933, 1060, 50408, 22535, 49743, 14476, 24625, 3393, 24605, 4306, 34386, 763, 47150, 50272, 1536, 9544, 14855, 52552, 5510, 42096, 2609, 50728, 37024, 5338, 1896, 5126, 9641, 10265, 49464, 5934, 28696, 37097, 32799, 2177, 45216, 34600, 19369, 16898, 12299, 37396, 15363, 21044, 6595, 14376, 52224, 62499, 6354, 33421, 416, 32391, 160, 10054, 16445, 384, 20595, 44992, 41011, 43344, 33290, 35144, 10503, 41229, 9411, 53310, 4385, 57370, 2080, 52018, 1760, 53549, 690, 59243, 37336, 23810, 26712, 545, 43073, 865, 18454, 782, 34829, 17116, 22915, 16894, 28352, 48518, 33154, 57396, 997, 28943, 17880, 4368, 17233, 18828, 7332, 773, 58620, 5985, 57400, 36288, 28717, 56944, 58894, 18160, 24069, 8506, 374, 28716, 1577, 12343, 537, 14388, 17166, 30036, 31112, 47373, 4250, 4866, 32880, 7857, 16406, 2152, 14982, 8544, 50710, 42160, 9527, 41226, 4408, 18732, 1990, 61492, 2176, 58397, 652, 39946, 49187, 59103, 53640, 3330, 26738, 4352, 12404, 14725, 51011, 34172, 46480, 4695, 9733, 32948, 42058, 20592, 16157, 41000, 377, 41487, 17984, 6169, 49486, 43713, 16858, 7297, 32869, 643, 27, 18251, 30211, 88, 39939, 456, 25607, 16432, 1092, 16446, 5542, 29757, 2081, 32794, 652, 22033, 768, 21401, 17784, 12295, 48531, 2465, 64256, 35624, 38918, 496, 40212, 32792, 3074, 320, 39812, 1232, 20003, 9330, 40080, 3101, 1076, 40313, 48, 52742, 27840, 9010, 43616, 1344, 12342, 3216, 36906, 2024, 21424, 41134, 17408, 4268, 9026, 21526, 44059, 44442, 3033, 14894, 17424, 2593, 26424, 9479, 33130, 19712, 7363, 55122, 29704, 2409, 30768, 34123, 12304, 16552, 47540, 61096, 3208, 49280, 35791, 13737, 2057, 52245, 593, 52941, 479, 14080, 14617, 22281, 59638, 18992, 25187, 47408, 12593, 33408, 30015, 20192, 5633, 4264, 6662, 45834, 5249, 43025, 1610, 48785, 41616, 13040, 41000, 24851, 55408, 5251, 13345, 36076, 8283, 32193, 4390, 30816, 3091, 41835, 22752, 21202, 49408, 48129, 4319, 704, 29188, 40984, 3136, 33287, 52755, 57922, 6785, 61, 3344, 1546, 16414, 3962, 26632, 26756, 1074, 14988, 57355, 44156, 29702, 209, 45008, 33732, 41121, 2056, 49608, 20504, 34636, 50184, 36468, 4032, 49158, 39153, 50528, 20490, 53429, 19008, 6153, 49370, 11902, 1539, 57450, 1304, 15618, 181, 18144, 20487, 24620, 1856, 52739, 16580, 3598, 4360, 29321, 26928, 33039, 43056, 3518, 18339, 29, 3344, 4108, 46225, 8352, 22021, 8286, 58420, 33801, 12421, 1952, 15042, 49277, 60512, 10262, 32964, 1792, 22254, 38598, 26272, 3084, 24630, 36196, 28935, 17464, 2580, 5124, 49264, 1344, 22018, 183, 43912, 22542, 62570, 3850, 39943, 4618, 1856, 20993, 156, 16, 49160, 26852, 43361, 52677, 24588, 1696, 14337, 16571, 33694, 9199, 61482, 1444, 31233, 4810, 33790, 19809, 32977, 2960, 41994, 10271, 26928, 4110, 24704, 33668, 62254, 43209, 4058, 49093, 13383, 51510, 10758, 39038, 11172, 52744, 32856, 1220, 23240, 14981, 1808, 14340, 42060, 1906, 22016, 41082, 657, 24584, 16458, 2128, 4643, 16585, 33536, 20552, 18996, 3906, 9967, 10882, 3216, 20876, 32774, 44706, 27140, 64640, 34880, 29935, 34879, 58560, 30723, 153, 57360, 33799, 24808, 50520, 49158, 41177, 42192, 51214, 53376, 34944, 64526, 273, 2452, 26437, 45100, 2380, 51809, 34878, 384, 41992, 32881, 1012, 5129, 53308, 20064, 30724, 18629, 35248, 49156, 53367, 25476, 31240, 32845, 1040, 52577, 29032, 1290, 40622, 24786, 10544, 30728, 26672, 1074, 52713, 12487, 24672, 42113, 53510, 3680, 34188, 35438, 3008, 3201, 16444, 33612, 11328, 41132, 3676, 29857, 4351, 52134, 33800, 32792, 35196, 47368, 32904, 28134, 53505, 32811, 57664, 6542, 53444, 384, 14341, 21635, 26384, 49452, 32778, 320, 7820, 32851, 4322, 13062, 57458, 192, 36228, 10437, 18240, 57572, 53312, 35152, 37637, 6163, 5174, 53508, 51274, 256, 59407, 49226, 2886, 31233, 32788, 4032, 53506, 41073, 1442, 58884, 53344, 1920, 21995, 49172, 1281, 58893, 3668, 768, 53516, 32886, 1536, 15465, 230, 1888, 29192, 2136, 34072, 28166, 45605, 50286, 18948, 32891, 19376, 11264, 49389, 3296, 19463, 4252, 4368, 6145, 8808, 18302, 20199, 22020, 384, 16384}
func BenchmarkCompress(b *testing.B) {
for i := 0; i < b.N; i++ {
//nolint:errcheck
Compress(benchString)
}
}
func BenchmarkDecompress(b *testing.B) {
for i := 0; i < b.N; i++ {
//nolint:errcheck
Decompress(benchCompressed)
}
}