{"id":176897,"date":"2020-10-18T14:15:47","date_gmt":"2020-10-18T06:15:47","guid":{"rendered":"http:\/\/4563.org\/?p=176897"},"modified":"2020-10-18T14:15:47","modified_gmt":"2020-10-18T06:15:47","slug":"%e5%88%86%e4%ba%ab%e4%b8%80%e4%b8%8b%e8%87%aa%e5%b7%b1%e7%9a%84%e5%81%9a%e7%9a%84-python-profiling-debugging-logging-%e5%b7%a5%e5%85%b7-viztracer","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=176897","title":{"rendered":"\u5206\u4eab\u4e00\u4e0b\u81ea\u5df1\u7684\u505a\u7684 Python profiling\/debugging\/logging \u5de5\u5177 VizTracer"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5206\u4eab\u4e00\u4e0b\u81ea\u5df1\u7684\u505a\u7684 Python profiling\/debugging\/logging \u5de5\u5177 VizTracer               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : laike9m <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p><strong>\u9996\u5148\u58f0\u660e\u8fd9\u4e2a\u4e0d\u662f\u6211\u5199\u7684\uff0c\u800c\u662f\u66ff\u521a\u6ce8\u518c V2 \u8fd8\u4e0d\u80fd\u53d1\u5e16\u7684\u670b\u53cb\u53d1\u7684\u3002\u5f53\u7136\u6211\u89c9\u5f97 VizTracer \u786e\u5b9e\u4e0d\u9519\uff0c\u6bd4\u5176\u5b83\u7684\u706b\u7130\u56fe\u5e93\u66f4\u7b26\u5408\u76f4\u89c9\u3002<\/strong> \u4ed6\u7684\u8d26\u53f7\uff1a@gaogaotiantian<\/p>\n<p>\u4e0b\u9762\u662f\u6b63\u6587\u3002<\/p>\n<p>\u5c0f\u4f19\u4f34\u4eec\u5927\u5bb6\u597d~\u4eca\u5929\u6765\u5206\u4eab\u4e00\u4e0b\u6211\u8fd9\u51e0\u4e2a\u6708\u505a\u7684\u5f00\u6e90\u9879\u76ee VizTracer \u3002\u5148\u628a\u5730\u5740\u7ed9\u4e86\u3002<\/p>\n<p><strong>https:\/\/github.com\/gaogaotiantian\/viztracer<\/strong><\/p>\n<p>VizTracer \u7684\u6838\u5fc3\u529f\u80fd\u662f\u5e2e\u52a9\u4f60\u7406\u89e3\u4f60\u7684\u4ee3\u7801\u5230\u5e95\u5728\u5e72\u4ec0\u4e48\u3002\u5b83\u4f1a trace \u4f60\u7684 python code\uff0c\u8bb0\u5f55\u6bcf\u4e00\u6b21\u51fd\u6570\u8fd0\u884c\u548c\u8fd4\u56de\u7684\u65f6\u95f4\u70b9\uff0c\u6700\u540e\u751f\u6210\u4e00\u4e2a html \u6587\u4ef6\u628a\u6574\u4e2a\u8fd0\u884c\u7ed3\u679c\u53ef\u89c6\u5316\uff0c\u5927\u6982\u957f\u8fd9\u4e2a\u6837\u5b50\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/10\/20201029_5f9ac11a35dd0.png\" alt=\"\u5206\u4eab\u4e00\u4e0b\u81ea\u5df1\u7684\u505a\u7684 Python profiling\/debugging\/logging \u5de5\u5177 VizTracer\" \/><\/p>\n<p>\u53ef\u80fd\u6709\u4e9b\u540c\u5b66\u7528\u8fc7\u4e00\u4e9b\u4ee3\u7801\u8fd0\u884c\u53ef\u89c6\u5316\u7684\u5e93\uff0c\u6bd4\u5982 gprof2dot \u6216\u8005 snakeviz \u4e4b\u7c7b\uff0c\u4e5f\u53ef\u80fd\u5927\u5bb6\u89c9\u5f97\u8fd9\u4e2a\u56fe\u548c flamegraph \u4e5f\u5c31\u662f\u706b\u7130\u56fe\u5f88\u50cf\uff0c\u4f46\u662f VizTracer \u5e26\u6765\u7684\u4fe1\u606f\u548c\u4e00\u5207 profiler \u662f\u4e0d\u592a\u4e00\u6837\u7684\u3002<\/p>\n<p>\u5982\u679c\u4ed4\u7ec6\u89c2\u5bdf\u7684\u8bdd\u80fd\u770b\u51fa\u6765\uff0cVizTracer \u7684\u6a2a\u8f74\u662f\u65f6\u95f4\uff0c\u5b83\u8bb0\u5f55\u4e86\u6240\u6709\u4e8b\u4ef6\uff08\u51fd\u6570\uff09\u53d1\u751f\u7684\u987a\u5e8f\uff0c\u8c01\u8c03\u7528\u7684\u8c01\uff0c\u6bcf\u4e00\u6b21\u8fd0\u884c\u7684\u65f6\u95f4\uff0c\u800c\u4e0d\u662f\u5355\u7eaf\u5730\u67d0\u4e2a\u51fd\u6570\u4e00\u5171\u5360\u4e86\u591a\u5c11\u65f6\u95f4\uff0c\u6216\u8005\u662f\u603b\u7ed3\u6027\u7684\u51fd\u6570\u5173\u7cfb\u56fe\u3002VizTracer \u5c55\u793a\u7684\u6570\u636e\u662f\u4e00\u5207\u4ee5 cProfile \u4e3a\u57fa\u7840\u7684\u5e93\u90fd\u6ca1\u6cd5\u5c55\u793a\u7684\uff0c\u56e0\u4e3a cProfile \u538b\u6839\u5c31\u6ca1\u8bb0\u5f55\u8fd9\u4e9b\u6570\u636e\u3002\u76f8\u6bd4\u8d77\u8fd9\u4e9b&#8221;profiler&#8221;\uff0cVizTracer \u66f4\u50cf\u4e00\u4e2a logging tool \u3002<\/p>\n<p>\u5148\u7b80\u5355\u8bf4\u4e00\u4e0b VizTracer \u600e\u4e48\u7528\u5427\u3002\u5728\u8bbe\u8ba1\u4e4b\u521d\uff0c\u6211\u7684\u7406\u5ff5\u5c31\u662f\u8981\u8ba9\u5de5\u5177\u5c3d\u53ef\u80fd\u5730\u597d\u4e0a\u624b\uff0c\u6240\u4ee5 VizTracer \u7684\u4f7f\u7528\u5176\u5b9e\u7279\u522b\u5bb9\u6613\uff1a<\/p>\n<pre><code>pip install viztracer  viztracer your_script.py <\/code><\/pre>\n<p>\u662f\u4e0d\u662f\u8d85\u7ea7\u7b80\u5355\u3002\u57fa\u672c\u4e0a\u4f60\u53ea\u9700\u8981\u628a\u539f\u6765\u7684<\/p>\n<pre><code>python your_script.py arg1 arg2 <\/code><\/pre>\n<p>\u53d8\u6210<\/p>\n<pre><code>viztracer your_script.py arg1 arg2 <\/code><\/pre>\n<p>\u5c31\u884c\u4e86\u3002<\/p>\n<p>\u5728\u8fd0\u884c\u4e4b\u540e\uff0cVizTracer \u4f1a\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u751f\u6210\u4e00\u4e2a<code>result.html<\/code>\u6587\u4ef6\uff0c\u7528 chrome \u6253\u5f00\u5b83\u5373\u53ef\u3002\u6211\u81ea\u5df1\u751f\u6210\u4e86\u4e00\u4e9bdemo\uff0c\u611f\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u770b\u4e00\u4e0b\u3002<\/p>\n<p>\u9664\u4e86\u6700\u57fa\u7840\u7684\u8bb0\u5f55\u51fd\u6570 entry\/exit \u7684\u529f\u80fd\u4e4b\u5916\uff0cVizTracer \u8fd8\u6709\u5f88\u591a\u5176\u4ed6 loggin \u529f\u80fd\uff0c\u6bd4\u8f83\u6709\u8da3\u7684\u4e8b\uff0c\u8fd9\u91cc\u9762\u6709\u5927\u91cf\u7684\u529f\u80fd\u662f\u53ef\u4ee5\u4e0d\u6539\u6e90\u4ee3\u7801\u5c31\u5b8c\u6210\u7684\u3002<\/p>\n<p>\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u4f60\u53ef\u4ee5\u8ba9 VizTracer \u8bb0\u5f55\u6bcf\u4e2a\u51fd\u6570\u7684 arguments \u548c return value\uff0c\u53ea\u9700\u8981<\/p>\n<pre><code>viztracer --log_return_value --log_function_args your_script.py <\/code><\/pre>\n<p>\u6216\u8005\u4f60\u53ef\u4ee5\u8ba9 VizTracer \u8bb0\u5f55\u4efb\u4f55\u7b26\u5408\u67d0\u4e9b RegEx \u7684\u53d8\u91cf<\/p>\n<pre><code>viztracer --log_var &lt;regex1&gt; &lt;regex2&gt; --run your_script.py <\/code><\/pre>\n<p>\u8fd9\u4e2a\u7684\u6548\u679c\u662f\uff0c\u5982\u679c\u6709\u4e00\u4e2a\u53d8\u91cf\u7684\u540d\u79f0\u7b26\u5408<code>&lt;regex1&gt;<\/code>\u6216\u8005<code>&lt;regex2&gt;<\/code>\uff0cVizTracer \u5c31\u4f1a\u5728\u8fd9\u4e2a\u53d8\u91cf\u6bcf\u6b21\u88ab assign \u4e4b\u540e\u8bb0\u5f55\u4e00\u4e2a custom event\uff0c\u8ba9\u4f60\u53ef\u4ee5\u5728 report \u91cc\u770b\u5230\u5b83\u88ab\u6539\u6210\u4ec0\u4e48\u503c\u4e86\u3002\uff08\u8fd9\u91cc\u589e\u52a0\u4e86<code>--run<\/code>\u662f\u4e3a\u4e86\u53bb\u6b67\u4e49\uff0c<code>--log_var<\/code>\u53ef\u4ee5 take \u4efb\u610f\u591a\u7684\u503c\uff09<\/p>\n<p>\u53e6\u5916 VizTracer \u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e9b filter \u529f\u80fd\uff0c\u8ba9\u4f60\u53ef\u4ee5\u4e0d\u8bb0\u5f55\u4f60\u4e0d\u611f\u5174\u8da3\u7684\u5185\u5bb9\u3002\u6bd4\u5982\u4f60\u53ef\u4ee5\u53ea\u8bb0\u5f55\u67d0\u4e9b\u6587\u4ef6\u91cc\u7684\u51fd\u6570<\/p>\n<pre><code>viztracer --include_files .\/src --run your_script.py <\/code><\/pre>\n<p>\u5176\u5b9e\u8fd8\u6709\u5f88\u591a\u5f88\u591a feature\uff0c\u6b22\u8fce\u5927\u5bb6\u53bb\u8bd5\u7528\u4e00\u4e0b\uff0c\u8fd9\u91cc\u53ea\u4ecb\u7ecd\u4e86\u5f00\u7bb1\u5373\u7528\u7684\u4e0d\u6539\u4ee3\u7801\u7684\u4e00\u5c11\u90e8\u5206 feature\uff0c\u8fd8\u6709\u4e00\u4e9b custom event \u53ef\u4ee5\u4fee\u6539\u6e90\u4ee3\u7801\u6765\u66f4\u7cbe\u786e\u5730\u8bb0\u5f55\u6570\u636e\u7684\u53d8\u5316\u3002<\/p>\n<p>\u6700\u540e\u5176\u5b9e\u6211\u60f3\u63d0\u4e00\u53e5\u7684\u662f\uff0cVizTracer \u662f\u6211\u5f88\u8ba4\u771f\u5bf9\u5f85\u7684\u4e00\u4e2a\u9879\u76ee\uff0c\u4e0d\u662f\u5f53\u4f5c\u73a9\u5177\u505a\u7684\uff0c\u6211\u5199\u4e86\u6bd4\u8f83\u8be6\u7ec6\u7684\u6587\u6863\uff08\u6240\u6709\u7684 feature \u90fd\u4ecb\u7ecd\u4e86\uff09\uff0ctest coverage \u505a\u5230\u4e86 99.5%+\uff0c\u652f\u6301 Linux\/MacOS\/Windows \u3002\u53e6\u5916\u4e3a\u4e86\u8ffd\u6c42 performance\uff0cVizTracer \u7684\u6838\u5fc3\u4ee3\u7801\u662f\u7eaf C \u5199\u7684\uff08\u6240\u4ee5\u53ea\u652f\u6301 CPython \uff09\uff0c\u4ea7\u751f\u7684 Overhead \u548c cProfile \u662f\u5dee\u4e0d\u591a\u7684\uff0c\u5728 worst case \u5927\u6982\u662f 2x-3x \u8fd9\u4e2a\u6570\u91cf\u7ea7\uff08\u5f53\u7136\u524d\u63d0\u662f\u6ca1\u6709 log \u592a\u591a custom \u7684\u4e1c\u897f\uff09\u3002<\/p>\n<p>\u5c31\u5148\u4ecb\u7ecd\u5230\u8fd9\u91cc\u5427\uff01\u6b22\u8fce\u5927\u5bb6\u8bd5\u7528\u4ee5\u53ca\u63d0\u51fa\u5b9d\u8d35\u610f\u89c1\u54c8\uff01\u6709\u4efb\u4f55\u95ee\u9898\u53ef\u4ee5\u4e0b\u9762\u7559\u8a00\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u53bb github \u7ed9\u6211\u63d0 issue~<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>17<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3906560\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ruanimal <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             lz \u6bc5\u529b\u5f3a\uff0cgithub \u57fa\u672c\u6bcf\u5929\u90fd\u6709 commit                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906561\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : siluni <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u662f\u5c0f\u767d\u7528\u6237\uff0c\u521a\u624d\u8bd5\u7528\u4e86\u4e00\u4e0b\uff0c\u51e0\u767e\u884c\u4ee3\u7801\u7684 project \u8dd1\u51fa\u6765\u4e86\u4e00\u4e2a 156MB \u7684 html&#8230;\u662f\u6211\u7528\u6cd5\u6709\u95ee\u9898\u8fd8\u662f\u672c\u6765\u5c31\u8fd9\u4e48\u5927\u5462                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906562\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zouzou0208 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u4e86\u4e0b\uff0c\u505a\u7684\u597d\u68d2\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906563\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gaogaotiantian <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @siluni \u8fd9\u662f\u6b63\u5e38\u7684\uff0cVizTracer \u672c\u8eab\u8bb0\u5f55\u7684\u6570\u636e\u975e\u5e38\u591a\uff0c\u6240\u4ee5 log \u4f1a\u5f88\u5927\u3002\u4ee3\u7801\u7684\u884c\u6570\u51e0\u767e\u884c\u53ef\u80fd\u6709\u5f88\u591a\u7684 function call\uff0c\u5341\u884c\u4ee3\u7801\u5c31\u53ef\u4ee5\u6709\u51e0\u5341\u4e07\u4e2a call \u5bf9\u5427~\u548c cProfile \u4e0d\u540c\uff0cVizTracer \u5bf9\u4e8e\u6bcf\u4e2a call \u90fd\u8981\u5355\u72ec\u8bb0\u5f55\u4e00\u4e2a entry\uff0c\u6240\u4ee5\u6587\u4ef6\u4f1a\u6bd4\u8f83\u5927~                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906564\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : siluni <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @gaogaotiantian \u660e\u767d\u4e86\uff01\u975e\u5e38\u611f\u8c22\u60a8\u7684\u4f5c\u54c1\u548c\u56de\u590d~\u5df2 star                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906565\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Ehco1996 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5728\u8fd0\u884c\u4e4b\u540e\uff0cVizTracer \u4f1a\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u751f\u6210\u4e00\u4e2a result.html \u6587\u4ef6 -&gt; \u6362\u6210\u7a0b\u5e8f\u7ed3\u675f\u4e4b\u540e                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906566\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gaogaotiantian <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Ehco1996 \u786e\u5b9e\u5e94\u8be5\u662f\u7ed3\u675f\u4e4b\u540e~\u4e0d\u8fc7\u6587\u7ae0\u4f3c\u4e4e\u5df2\u7ecf\u6539\u4e0d\u4e86\u4e86~\u5927\u5bb6\u5e94\u8be5\u5dee\u4e0d\u591a\u80fd\u7406\u89e3\u5427~\u54c8\u54c8~                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906567\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : no1xsyzy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u8d77\u6765\u633a\u4e0d\u9519\u7684\uff0c\u4f46\u5176\u5b9e\u6211\u4e00\u76f4\u6ca1\u641e\u61c2\u706b\u7130\u56fe\u600e\u4e48\u770b\uff08                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906568\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gaogaotiantian <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @no1xsyzy \u54c8~\u8fd9\u4e2a\u4e0d\u662f\u706b\u7130\u56fe\uff0c\u7b97\u662f call stack \u56fe\u5427~\u6838\u5fc3\u5c55\u793a\u5185\u5bb9\u662f\u51fd\u6570\u4e4b\u95f4\u7684\u8c03\u7528\u6b21\u5e8f\u548c\u65f6\u95f4                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906569\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : THP301 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e2a\u4f5c\u54c1\u4ece\u5b9e\u7528\u6027\u548c\u6613\u7528\u6027\u90fd\u505a\u5230\u4e86\u6781\u81f4\uff0c\u751f\u6210\u7684\u56fe\u8fd8\u975e\u5e38\u76f4\u89c2\uff0c\u5c11\u6709\u7684\u4f5c\u54c1                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906570\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gaogaotiantian <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @THP301 \u8c22\u8c22\u5982\u6b64\u9ad8\u7684\u8bc4\u4ef7\u554a~\u5b9e\u7528\u6027\u548c\u6613\u7528\u6027\u786e\u5b9e\u662f\u6211\u505a\u8fd9\u4e2a\u9879\u76ee\u65f6\u5019\u5f88\u671f\u671b\u8fbe\u6210\u7684\u76ee\u6807~                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906571\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : frostming <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5728 POSIX getopt \u6807\u51c6\u91cc\u9762&#8221;&#8211;&#8221; \u53ef\u4ee5\u7528\u6765\u5206\u9694 option \u548c positinal args\uff0c&#8211; \u540e\u9762\u7684\u53c2\u6570\u901a\u901a\u5f53\u505a positional args \u585e\u7ed9 Python \u5c31\u597d\u4e86\uff0c\u8fd9\u4e2a\u662f\u6709\u60ef\u4f8b\u7684\uff0c\u4e2a\u4eba\u8ba4\u4e3a\u4f1a\u6bd4&#8211;run \u597d\uff0c\u51cf\u5c11\u4e00\u4e2a\u8bb0\u5fc6\u70b9                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906572\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : frostming <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u770b\u4e86\u4e00\u4e0b\u4f60\u7528\u7684 argparse\uff0c\u8fd9\u4e9b\u4e3b\u6d41\u6846\u67b6\u90fd\u662f\u652f\u6301\u8fd9\u4e48\u5f04\u7684\uff0c\u4e0d\u9700\u8981\u989d\u5916\u7684\u5904\u7406\u4ee3\u7801\uff0c\u5982\u679c\u6709\u9700\u8981\u6211\u53ef\u4ee5 pr                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906573\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : no1xsyzy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @gaogaotiantian \u62ff\u4e3b\u9898\u8fd9\u5f20\u56fe\u4ed4\u7ec6\u770b\u4e86\u770b\uff0c\u7ed3\u5408\u4f60\u8fd9\u53e5\u56de\u590d\u2026\u2026<br \/>\u6211\u4e00\u76f4\u4ee5\u4e3a\u706b\u7130\u56fe\u5c31\u662f call stack \u56fe\uff0c\u539f\u6765\u4e0d\u662f\u5417\uff1f\u96be\u602a\u770b\u4e0d\u61c2\u2026\u2026<br \/>\u597d\u5427\uff0c\u4ec0\u4e48\u65f6\u5019\u518d\u53bb\u770b\u770b\u706b\u7130\u56fe\u600e\u4e48\u770b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906574\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : laike9m <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @no1xsyzy \u6211\u4e5f\u4ee5\u4e3a\u662f\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906575\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gaogaotiantian <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @frostming \u8fd9\u662f\u4e2a\u633a\u597d\u7684\u5efa\u8bae\u2026\u2026\u6211\u8fd9\u4e24\u5929\u5c31\u5f04\u4e00\u4e0b\uff0c\u628a&#8211;run \u4f5c\u4e3a undocumented feature \uff08\u4e3a\u4e86 backward compatibility \uff09\uff0c\u7136\u540e\u7528&#8211;\u4e3a\u4e3b\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3906576\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gaogaotiantian <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @no1xsyzy VizTracer \u63d0\u4f9b\u7684\u56fe\u786e\u5b9e\u6709\u548c\u706b\u7130\u56fe\u5f88\u76f8\u4f3c\u7684\u5730\u65b9\u3002\u7b80\u5355\u6765\u8bf4\uff0c\u706b\u7130\u56fe\u662f\u4e00\u4e2a\u201c\u603b\u7ed3\u201d\u6027\u7684\u56fe\uff0c\u5b83\u5c55\u793a\u7684\u662f\u67d0\u4e00\u4e2a\u51fd\u6570\u5728\u8fd9\u4e2a\u4f4d\u7f6e\u5360\u636e\u7684\u603b\u65f6\u95f4\u3002\u800c VizTracer \u7684\u56fe\u662f\u6bcf\u4e00\u6b21\u8c03\u7528\u90fd\u4f1a\u6709\u4e00\u4e2a\u5c55\u793a\u3002<\/p>\n<p>\u6bd4\u5982\u8bf4\uff0cA \u8c03\u7528\u4e86 B 100 \u6b21\uff0c\u6bcf\u6b21 1ms \u3002\u5728\u706b\u7130\u56fe\u4e0a\uff0c\u5c31\u662f\u6700\u4e0b\u9762\u662f A\uff0cA \u7684\u5bbd\u5ea6\u662f 100ms \u7684 B \u52a0\u4e0a A \u81ea\u5df1\u7684\u8017\u65f6\uff0cA \u4e0a\u9762\u6709\u4e00\u4e2a B\uff0cB \u7684\u5bbd\u5ea6\u662f 100ms \u3002\u800c VizTracer \u7684\u56fe\u4e0a\uff0c\u6700\u4e0b\u9762\u662f A\uff0cA \u4e0a\u9762\u6709 100 \u4e2a 1ms \u7684 B\uff0c\u6bcf\u4e2a B \u4e4b\u95f4\u7684\u95f4\u9694\u5c31\u662f\u4ed6\u4eec\u88ab\u8c03\u7528\u4e4b\u95f4 A \u7684\u8017\u65f6\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5206\u4eab\u4e00\u4e0b\u81ea\u5df1\u7684\u505a\u7684 Python &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/176897"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=176897"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/176897\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=176897"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=176897"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=176897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}