{"id":1667,"date":"2017-12-16T08:35:24","date_gmt":"2017-12-16T00:35:24","guid":{"rendered":"http:\/\/ufqi.com\/blog\/?p=1667"},"modified":"2017-12-16T08:36:01","modified_gmt":"2017-12-16T00:36:01","slug":"base62x-vs-base64-speedtest","status":"publish","type":"post","link":"https:\/\/ufqi.com\/blog\/base62x-vs-base64-speedtest\/","title":{"rendered":"Base62x\u6bd4Base64\u7684\u7f16\u7801\u901f\u5ea6\u66f4\u5feb\u5417?"},"content":{"rendered":"<p><img src=\"https:\/\/ufqi.com\/blog\/wp-content\/uploads\/2016\/09\/b62x-icon-201306.png\" \/><\/p>\n<p>Base62x\u4e0eBase64\u7684\u7f16\u7801\u901f\u5ea6\u6d4b\u8bc4<\/p>\n<p>\u73b0\u5728\u51e0\u4e4e\u6240\u6709\u4f01\u4e8b\u4e1a\u5355\u4f4d\u3001\u653f\u5e9c\u673a\u6784\u3001\u519b\u5de5\u7cfb\u7edf\u7b49\u7684IT\u751f\u4ea7\u7cfb\u7edf\u90fd\u4f1a\u7528\u5230Base64\u7f16\u7801\uff0c\u4eceRSA\u5b89\u5168\u5bc6\u94a5\u5230\u7ba1\u7406\u4fe1\u606f\u7cfb\u7edf\u767b\u5f55\u5165\u53e3\u56de\u8df3\uff0c\u76ee\u524d\u8d8a\u6765\u8d8a\u591a\u7684IT\u7cfb\u7edf\u7814\u53d1\u8005\u5f00\u59cb\u4f7f\u7528 Base62x \u66ff\u6362 Base64.<\/p>\n<p>Base62x \u63d0\u4f9b\u4e86\u4e00\u79cd\u65e0\u7b26\u53f7\u8f93\u51fa\u7684Base64\u7684\u7f16\u7801\u65b9\u6848\uff0c\u5728\u8bb8\u591a\u5e94\u7528\u573a\u5408\u5176\u7eaf\u5b57\u6bcd\u548c\u6570\u5b57\u7684\u8f93\u51fa\u5f62\u5f0f\uff0c\u53ef\u4ee5\u6709\u6548\u7684\u89c4\u907f\u56e0\u4e3a\u7b26\u53f7\u5e26\u6765\u7684\u5404\u79cd\u8d1f\u9762\u5f71\u54cd\uff0c\u5e76\u80fd\u591f\u6709\u6548\u524a\u51cf\u6216\u517c\u5bb9\u5404\u79cdBase64\u7684\u53d8\u79cd\u5f62\u5f0f\u3002<\/p>\n<p>\u501f\u7740 Base62x \u5728 -GitHub \u4e0a\u83b7\u5f97\u51e0\u4e2a\u8d5e\u4e4b\u540e\uff0c\u6211\u4eec\u63a2\u8ba8\u53e6\u5916\u4e00\u4e2a\u95ee\u9898\uff0cBase62x \u7684\u7f16\u7801\u5728\u8f93\u51fa\u6587\u672c\u5f62\u5f0f\u4e0a\u7565\u80dc\u4e00\u7b79\uff0c\u662f\u503c\u5f97\u63a8\u8350\u7684\u66ff\u4ee3\u65b9\u6848\uff0c\u4f46\u5176\u7f16\u7801\u901f\u5ea6\u548c\u6548\u7387\u5982\u4f55?<\/p>\n<p>\u4e3a\u6b64\u6211\u4eec\u8bbe\u8ba1\u4e00\u4e2a\u8bc4\u6d4b\u4efb\u52a1\uff0c\u5206\u522b\u4f7f\u7528Base62x \u548c Base64\u8fdb\u884c20\u4e07\u6b21\u7f16\u7801\u64cd\u4f5c\uff0c\u5176\u4e2dBase62x \u4f7f\u7528 PHP\u7684ext module\u65b9\u5f0f\u5b9e\u73b0\u7684 base62x_encode , Base64 \u4e5f\u662f PHP\u5185\u7f6e\u7684 base64_encode , \u4e24\u79cd\u5747\u662f\u4f7f\u7528C\u8bed\u8a00\u5b9e\u73b0\uff0c\u5e76\u901a\u8fc7\u6269\u5c55\u65b9\u5f0f\u96c6\u6210\u5728 PHP\u4e2d\uff0c\u76f8\u5bf9\u800c\u8a00\uff0c\u53ef\u6bd4\u6027\u8f83\u597d. \u8fd0\u884c\u4e3b\u673a\u662f\u5728 Windows\u4e0b\u865a\u62df\u4e3b\u673a\u8fd0\u884c OpenSuSE 42\uff0cNginx 1.12\uff0c PHP 7.0.<br \/>\u901a\u8fc7\u811a\u672cCommand Line\u8c03\u7528\u65b9\u5f0f\u8fdb\u884c20\u4e07\u6b21\u7f16\u7801\u4efb\u52a1\uff0c\u5bf9\u6bd4\u6d4b\u8bd5\u6570\u636e\uff1a<\/p>\n<p>base62x 200000 timestart:1513077337.6748 timecost:0.30399990081787<br \/>base64 200000 timestart:1513077337.9788 timecost:0.16817998886108<\/p>\n<p>base62x 200000 timestart:1513077401.2177 timecost:0.29567098617554<br \/>base64 200000 timestart:1513077401.5134 timecost:0.17081189155579<\/p>\n<p>base62x 200000 timestart:1513077424.234 timecost:0.30112099647522<br \/>base64 200000 timestart:1513077424.5351 timecost:0.1718909740448<\/p>\n<p>base62x 200000 timestart:1513077447.9861 timecost:0.29450607299805<br \/>base64 200000 timestart:1513077448.2806 timecost:0.16546702384949<\/p>\n<p>base62x 200000 timestart:1513077470.7367 timecost:0.45493698120117<br \/>base64 200000 timestart:1513077471.1917 timecost:0.24029588699341<\/p>\n<p>\u8fd0\u884c5\u6b21\u4e4b\u540e\uff0cBase62x \u548c Base64 \u5176\u5747\u503c\u5206\u522b\u4e3a\uff0c0.330047 \u548c 0.183329 . \u7531\u6b64\u53ef\u89c1\uff0cBase62x \u6bd4 Base64 \u5728\u7f16\u7801\u901f\u5ea6\u4e0a\u7a0d\u6162\uff0c20\u4e07\u6b21\u64cd\u4f5c\u8017\u65f6\u6bd4\u503c\u4e3a 1:0.555 , \u5c3d\u7ba1\u6bcf\u6b21\u64cd\u4f5c\u5176\u8017\u65f6\u5dee\uff087.33589E-07\uff09\u53ef\u4ee5\u5ffd\u7565\u4e0d\u8ba1\uff0c\u4f46\u8003\u5bdf\u6bd4\u503c\uff0cBase62x \u6162\u4e86\u5927\u7ea6 44.5%\uff0c\u5927\u81f4\u662f Base64 \u5b8c\u6210\u4e24\u4e2a\u7f16\u7801\u64cd\u4f5c\uff0c \u76ee\u524d\u7248\u672c\u7684 Base62x \u5b8c\u6210\u4e00\u4e2a\u591a\u4e00\u70b9\u7684\u7f16\u7801\u64cd\u4f5c\u3002<\/p>\n<p>\u5982\u679c\u52a0\u4e0a\u5728\u5e94\u7528\u5c42\u7684\u5404\u79cd\u5224\u65ad\uff0c\u4f7f\u7528 Base62x \u66ff\u4ee3 Base64 \u53ef\u80fd\u662f\u6709\u4f18\u52bf\u7684\uff0c\u6bd4\u5982\u5224\u65ad\u662f\u5426\u5305\u62ec+\uff0c\u8fdb\u800c\u8f6c\u5316\u4e3a\u7a7a\u683c\uff0c\u662f\u5426\u5305\u62ec\u7b49\u53f7\u7b49\uff0c\u56e0\u4e3a\u4efb\u4f55\u4e00\u6b65\u989d\u5916\u7684\u5224\u65ad\u6216\u66ff\u6362\u64cd\u4f5c\uff0c\u5176\u8017\u65f6\u5c06\u53ef\u80fd\u8fdc\u8d85\u8fc7 Base62x \u4e0e Base64 \u64cd\u4f5c\u8017\u65f6\u7684\u5dee\u503c\u3002<\/p>\n<p>\u6bd4\u5982\u5176\u4e2d\u4e00\u4e2a URLEncode \u7684\u5e94\u7528\u573a\u666f\uff0c\u5728 -github\/wadelau\/gMIS\/comm\/ido.js \u4e2d( <b><a class=\"bigfont\" href=\"https:\/\/ufqi.com\/url4p\/?sid=370638&amp;act=query&amp;shortkey=J2SI\" target=\"_blank\">-R\/J2SI<\/a><\/b> ):<\/p>\n<table class=\"highlight tab-size js-file-line-container\" style=\"height: 41px\" width=\"418\">\n<tbody>\n<tr>\n<td id=\"LC560\" class=\"blob-code blob-code-inner js-file-line\"><em><span class=\"pl-k\">var<\/span> actx <span class=\"pl-k\">=<\/span> <span class=\"pl-c1\">unescape<\/span>(<span class=\"pl-smi\">tObj<\/span>.<span class=\"pl-c1\">action<\/span>);<\/em><\/td>\n<\/tr>\n<tr>\n<td id=\"L561\" class=\"blob-num js-line-number\">actx <span class=\"pl-k\">=<\/span> <span class=\"pl-smi\">actx<\/span>.<span class=\"pl-c1\">replace<\/span>(<span class=\"pl-s\"><span class=\"pl-pds\">&#8216;<\/span>+<span class=\"pl-pds\">&#8216;<\/span><\/span>, <span class=\"pl-s\"><span class=\"pl-pds\">&#8216;<\/span> <span class=\"pl-pds\">&#8216;<\/span><\/span>);<\/td>\n<td id=\"LC561\" class=\"blob-code blob-code-inner js-file-line\">\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u53d6\u4ee3\u7684\u6539\u8fdb\u4f7f\u7528Base62x\u7684\u65b9\u6848\u662f\uff1a<em><br \/><\/em><\/p>\n<table class=\"highlight tab-size js-file-line-container\" style=\"height: 45px\" width=\"643\">\n<tbody>\n<tr>\n<td id=\"LC560\" class=\"blob-code blob-code-inner js-file-line\"><em><span class=\"pl-k\">var<\/span> actx <span class=\"pl-k\">=<\/span> Base62x.decode(<span class=\"pl-smi\">tObj<\/span>.<span class=\"pl-c1\">action<\/span>);<\/em><\/td>\n<\/tr>\n<tr>\n<td id=\"L561\" class=\"blob-num js-line-number\">\u00a0\/* no more action needed *\/<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ece\u4ee3\u7801\u5c42\u5206\u6790\u8017\u65f6\u5dee\u503c\u539f\u56e0\uff0c\u5c3d\u7ba1\u4e24\u8005\u90fd\u4f7f\u7528\u4e86\u4f4d\u64cd\u4f5c\u8fdb\u884c\u8ba1\u7b97\uff0c\u4f46 Base62x \u5728\u5355\u4f4d\u7f16\u7801\u957f\u5ea6\u4e0a\u591a\u4e86\u6570\u503c\u5224\u65ad\uff0c\u7531\u6b64\u5bfc\u81f4\u5176\u901f\u5ea6\u4e0b\u964d\u3002Base62x \u8fd8\u662f\u65b0\u4e8b\u7269\uff0c\u5176\u4ee3\u7801\u5e94\u8be5\u8fd8\u6709\u53ef\u4ee5\u518d\u6539\u8fdb\u4f18\u5316\u7684\u7a7a\u95f4\u3002<\/p>\n<p>\u5982\u679c\u8fdb\u4e00\u6b65\u6539\u8fdb\u4f18\u5316\uff0cBase62x \u6709\u53ef\u80fd\u4e0e Base64 \u76f8\u540c\u7684\u7f16\u7801\u901f\u5ea6\u5417?<\/p>\n<p>\u6709\u6ca1\u6709\u53ef\u80fd\u5b58\u5728\u53e6\u5916\u4e00\u79cd\u4e0d\u9700\u8981\u6570\u503c\u5224\u65ad\uff0c\u4e5f\u80fd\u591f\u6ee1\u8db3\u4e0e Base62x \u4e00\u6837\u65e0\u7b26\u53f7\u8f93\u51fa\u768464\u8fdb\u5236\u7f16\u7801\u65b9\u6848?<\/p>\n<p>\u5c0f\u7ed3\uff0c\u5355\u5c31\u7f16\u7801\u901f\u5ea6\u800c\u8a00\uff0c Base64 \u65b9\u6848\u5feb\uff0c\u5982\u679c\u52a0\u4e0a\u5176\u4ed6\u5224\u65ad\u4e0e\u66ff\u6362\u64cd\u4f5c\uff0c Base62x \u65b9\u6848\u80dc\u51fa\uff0c\u672a\u6765\u53ef\u80fd\u4f1a\u6709\u9c7c\uff08\u65e0\u7b26\u53f7\u8f93\u51fa\uff09\u548c\u718a\u638c\uff08\u901f\u5ea6\uff09\u517c\u5f97\u7684\u65b0\u7f16\u7801\u65b9\u6848\u51fa\u73b0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Base62x\u4e0eBase64\u7684\u7f16\u7801\u901f\u5ea6\u6d4b\u8bc4 \u73b0\u5728\u51e0\u4e4e\u6240\u6709\u4f01\u4e8b\u4e1a\u5355\u4f4d\u3001\u653f\u5e9c\u673a\u6784\u3001\u519b &hellip; <a href=\"https:\/\/ufqi.com\/blog\/base62x-vs-base64-speedtest\/\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[161,6,2],"tags":[223,154,224,225],"_links":{"self":[{"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/posts\/1667"}],"collection":[{"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/comments?post=1667"}],"version-history":[{"count":20,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/posts\/1667\/revisions"}],"predecessor-version":[{"id":1688,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/posts\/1667\/revisions\/1688"}],"wp:attachment":[{"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/media?parent=1667"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/categories?post=1667"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/tags?post=1667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}