{"id":125070,"date":"2020-06-12T13:12:20","date_gmt":"2020-06-12T05:12:20","guid":{"rendered":"http:\/\/4563.org\/?p=125070"},"modified":"2020-06-12T13:12:20","modified_gmt":"2020-06-12T05:12:20","slug":"%e5%af%b9%e4%ba%8e-u3d-stopwatch-elapsedtick-%e7%9a%84%e7%96%91%e6%83%91","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=125070","title":{"rendered":"\u5bf9\u4e8e U3D Stopwatch ElapsedTick \u7684\u7591\u60d1"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5bf9\u4e8e U3D Stopwatch ElapsedTick \u7684\u7591\u60d1               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : bakatori <\/span>  <span><i><\/i> 8<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u8bb0\u5f55\u65b9\u6cd5<\/p>\n<pre><code>    static public void time (string key) {         if (timeKeyHub.ContainsKey (key)) {             Debug.LogError (\"MLOG.cs time key already exist\");         } else {             System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch ();             timeKeyHub.Add (key, sw);             sw.Start ();         }     }     static public void timeEnd (string key) {         if (timeKeyHub.ContainsKey (key)) {             System.Diagnostics.Stopwatch sw;             timeKeyHub.TryGetValue (key, out sw);             sw.Stop();             Debug.Log (string.Format (\"&lt;color=blue&gt;{0}&lt;\/color&gt; {1} ms {2} ticks\", key, sw.ElapsedMilliseconds, sw.ElapsedTicks));             \/\/ BIRDTODO:\u7528\u6c60\u5b50             sw = null;             timeKeyHub.Remove (key);         } else {             Debug.LogError (\"MLOG.cs timeend key not exist\");         }     } <\/code><\/pre>\n<p>A*\u7b97\u6cd5\u7684\u90e8\u5206\u4ee3\u7801<\/p>\n<pre><code>    MLOG.time(\"newCostDealer\");     MLOG.time(\"newCostDealer - newCost\");     float newCost = cost_so_far[cur]+ heuristic(next.Pos, end.Pos);     MLOG.timeEnd(\"newCostDealer - newCost\");      MLOG.time(\"newCostDealer - 0\");     bool tmp2 = !cost_so_far.ContainsKey(next);     MLOG.timeEnd(\"newCostDealer - 0\");      MLOG.time(\"newCostDealer - temp3\");     bool tmp3 = false;     if (!tmp2) {         tmp3 = newCost &lt; cost_so_far[next];     }     MLOG.timeEnd(\"newCostDealer - temp3\");      if (tmp2 || tmp3)     {         MLOG.time(\"newCostDealer - 1\");         frontier.put(next, newCost);         MLOG.timeEnd(\"newCostDealer - 1\");          MLOG.time(\"newCostDealer - 2\");         cost_so_far[next] = newCost;         \/\/ MLOG.info(\"came_from[next] = cur,\" + next.ToString() + \" \" + cur.ToString());         came_from[next] = cur;         MLOG.timeEnd(\"newCostDealer - 2\");     }      MLOG.timeEnd(\"newCostDealer\"); <\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/06\/20200628_5ef81a482695f.png\" alt=\"\u5bf9\u4e8e U3D Stopwatch ElapsedTick \u7684\u7591\u60d1\" \/><\/p>\n<p>\u6c42\u6559\uff0c\u4e3a\u5565 newCostDealer ticks \u548c\u5176\u5b83\u8bb0\u5f55\u52a0\u8d77\u6765\u5dee\u90a3\u4e48\u591a\u4e2b\uff1f\uff01<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>1<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"2043904\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : bakatori <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6c42\u6559                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5bf9\u4e8e U3D Stopwatch &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\/125070"}],"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=125070"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/125070\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=125070"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=125070"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=125070"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}