{"action":"created","comment":{"url":"https://api.github.com/repos/minetest/minetest/pulls/comments/29591611","id":29591611,"diff_hunk":"@@ -85,272 +83,177 @@ function mod_statistics.update_statistics(dtime)\n \t\t\t\t\tavg_per = 0\n \t\t\t\t}\n \t\t\tend\n-\t\t\t\n-\t\t\tlocal toupdate = mod_statistics.stats[modname].types[type]\n-\t\t\t\n-\t\t\t--update us values\n-\t\t\ttoupdate.min_us = math.min(time, toupdate.min_us)\n-\t\t\ttoupdate.max_us = math.max(time, toupdate.max_us)\n-\t\t\t--TODO find better algorithm\n-\t\t\ttoupdate.avg_us = toupdate.avg_us * 0.99 + modtime * 0.01\n-\t\t\t\t\n-\t\t\t--update percentage values\n+\n+\t\t\tlocal to_update = stats.types[tp]\n+\n+\t\t\t-- Update microsecond values\n+\t\t\tto_update.min_us = math.min(time, to_update.min_us)\n+\t\t\tto_update.max_us = math.max(time, to_update.max_us)\n+\t\t\t-- TODO: Find better algorithm\n+\t\t\tto_update.avg_us = to_update.avg_us * 0.99 + mod_time * 0.01\n+\n+\t\t\t-- Update percentage values\n \t\t\tlocal cur_per = (time/mod_statistics.step_total) * 100\n-\t\t\ttoupdate.min_per = math.min(toupdate.min_per, cur_per)\n-\t\t\t\t\n-\t\t\ttoupdate.max_per = math.max(toupdate.max_per, cur_per)\n-\t\t\t\t\n-\t\t\t--TODO find better algorithm\n-\t\t\ttoupdate.avg_per = toupdate.avg_per * 0.99 + cur_per * 0.01\n-\t\t\t\n-\t\t\tmod_statistics.data[modname][type] = 0\n+\t\t\tto_update.min_per = math.min(to_update.min_per, cur_per)\n+\n+\t\t\tto_update.max_per = math.max(to_update.max_per, cur_per)\n+\n+\t\t\t-- TODO: Find better algorithm\n+\t\t\tto_update.avg_per = to_update.avg_per * 0.99 + cur_per * 0.01\n+\n+\t\t\ttypes[tp] = 0\n \t\tend\n-\t\t\n-\t\t--per mod statistics\n-\t\t--update us values\n-\t\tmod_statistics.stats[modname].min_us =\n-\t\t\tmath.min(modtime, mod_statistics.stats[modname].min_us)\n-\t\tmod_statistics.stats[modname].max_us =\n-\t\t\tmath.max(modtime, mod_statistics.stats[modname].max_us)\n-\t\t--TODO find better algorithm\n-\t\tmod_statistics.stats[modname].avg_us =\n-\t\t\tmod_statistics.stats[modname].avg_us * 0.99 + modtime * 0.01\n-\t\t\t\n-\t\t--update percentage values\n-\t\tlocal cur_per = (modtime/mod_statistics.step_total) * 100\n-\t\tmod_statistics.stats[modname].min_per =\n-\t\t\tmath.min(mod_statistics.stats[modname].min_per, cur_per)\n-\t\t\t\n-\t\tmod_statistics.stats[modname].max_per =\n-\t\t\tmath.max(mod_statistics.stats[modname].max_per, cur_per)\n-\t\t\t\n-\t\t--TODO find better algorithm\n-\t\tmod_statistics.stats[modname].avg_per =\n-\t\t\tmod_statistics.stats[modname].avg_per * 0.99 + cur_per * 0.01\n+\n+\t\t-- Per mod statistics\n+\t\t-- Update microsecond values\n+\t\tstats.min_us = math.min(mod_time, stats.min_us)\n+\t\tstats.max_us = math.max(mod_time, stats.max_us)\n+\t\t-- TODO: Find better algorithm\n+\t\tstats.avg_us = stats.avg_us * 0.99 + mod_time * 0.01\n+\n+\t\t-- Update percentage values\n+\t\tlocal cur_per = (mod_time/mod_statistics.step_total) * 100\n+\t\tstats.min_per = math.min(stats.min_per, cur_per)\n+\n+\t\tstats.max_per = math.max(stats.max_per, cur_per)\n+\n+\t\t-- TODO: Find better algorithm\n+\t\tstats.avg_per = stats.avg_per * 0.99 + cur_per * 0.01\n \tend\n-\t\n-\t--update \"total\"\n-\tmod_statistics.stats[\"total\"].min_us =\n-\t\tmath.min(mod_statistics.step_total, mod_statistics.stats[\"total\"].min_us)\n-\tmod_statistics.stats[\"total\"].max_us =\n-\t\tmath.max(mod_statistics.step_total, mod_statistics.stats[\"total\"].max_us)\n-\t--TODO find better algorithm\n-\tmod_statistics.stats[\"total\"].avg_us =\n-\t\tmod_statistics.stats[\"total\"].avg_us * 0.99 +\n+\n+\t-- Update total\n+\tstats_t.min_us = math.min(mod_statistics.step_total, stats_t.min_us)\n+\tstats_t.max_us = math.max(mod_statistics.step_total, stats_t.max_us)\n+\t-- TODO: Find better algorithm\n+\tstats_t.avg_us = stats_t.avg_us * 0.99 +\n \t\tmod_statistics.step_total * 0.01\n-\t\n+\n \tmod_statistics.step_total = 0\n end\n \n---------------------------------------------------------------------------------\n-local function build_callback(log_id, fct)\n-\treturn function( toregister )\n-\t\tlocal modname = core.get_current_modname()\n-\t\t\n-\t\tfct(function(...)\n-\t\t\tlocal starttime = core.get_us_time()\n-\t\t\t-- note maximum 10 return values are supported unless someone finds\n-\t\t\t-- a way to store a variable lenght return value list\n-\t\t\tlocal r0, r1, r2, r3, r4, r5, r6, r7, r8, r9 = toregister(...)\n-\t\t\tlocal delta = core.get_us_time() - starttime\n-\t\t\tmod_statistics.log_time(log_id, modname, delta)\n-\t\t\treturn r0, r1, r2, r3, r4, r5, r6, r7, r8, r9\n-\t\t\tend\n-\t\t)\n+\n+local function elipsize(str, len)\n+\tif #str > len then\n+\t\treturn \"…\"..str:sub(-len + 1)","path":"builtin/game/mod_profiling.lua","position":204,"original_position":204,"commit_id":"89d5382f2a27d3b11e2d0ebb2a22eb197d1af171","original_commit_id":"89d5382f2a27d3b11e2d0ebb2a22eb197d1af171","user":{"login":"est31","id":8872119,"avatar_url":"https://avatars.githubusercontent.com/u/8872119?v=3","gravatar_id":"","url":"https://api.github.com/users/est31","html_url":"https://github.com/est31","followers_url":"https://api.github.com/users/est31/followers","following_url":"https://api.github.com/users/est31/following{/other_user}","gists_url":"https://api.github.com/users/est31/gists{/gist_id}","starred_url":"https://api.github.com/users/est31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/est31/subscriptions","organizations_url":"https://api.github.com/users/est31/orgs","repos_url":"https://api.github.com/users/est31/repos","events_url":"https://api.github.com/users/est31/events{/privacy}","received_events_url":"https://api.github.com/users/est31/received_events","type":"User","site_admin":false},"body":"ok then.","created_at":"2015-05-04T15:04:45Z","updated_at":"2015-05-04T15:04:45Z","html_url":"https://github.com/minetest/minetest/pull/2655#discussion_r29591611","pull_request_url":"https://api.github.com/repos/minetest/minetest/pulls/2655","_links":{"self":{"href":"https://api.github.com/repos/minetest/minetest/pulls/comments/29591611"},"html":{"href":"https://github.com/minetest/minetest/pull/2655#discussion_r29591611"},"pull_request":{"href":"https://api.github.com/repos/minetest/minetest/pulls/2655"}}},"pull_request":{"url":"https://api.github.com/repos/minetest/minetest/pulls/2655","id":34134418,"html_url":"https://github.com/minetest/minetest/pull/2655","diff_url":"https://github.com/minetest/minetest/pull/2655.diff","patch_url":"https://github.com/minetest/minetest/pull/2655.patch","issue_url":"https://api.github.com/repos/minetest/minetest/issues/2655","number":2655,"state":"open","locked":false,"title":"Clean up mod profiler","user":{"login":"ShadowNinja","id":3399154,"avatar_url":"https://avatars.githubusercontent.com/u/3399154?v=3","gravatar_id":"","url":"https://api.github.com/users/ShadowNinja","html_url":"https://github.com/ShadowNinja","followers_url":"https://api.github.com/users/ShadowNinja/followers","following_url":"https://api.github.com/users/ShadowNinja/following{/other_user}","gists_url":"https://api.github.com/users/ShadowNinja/gists{/gist_id}","starred_url":"https://api.github.com/users/ShadowNinja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShadowNinja/subscriptions","organizations_url":"https://api.github.com/users/ShadowNinja/orgs","repos_url":"https://api.github.com/users/ShadowNinja/repos","events_url":"https://api.github.com/users/ShadowNinja/events{/privacy}","received_events_url":"https://api.github.com/users/ShadowNinja/received_events","type":"User","site_admin":false},"body":"  * Fix wrappers only supporting 10 return values (used to use `local r0, r1, r2, r3 [...] = callback()`.\r\n  * Fix looking up the same value in a hash table many times; cache it.\r\n    This should improve speed pretty substantially.\r\n  * Reduce duplication through local functions.\r\n  * Use closures instead of storing functions in global lookup tables.\r\n  * `total` and `builtin` are valid mod names, don't blow up if someone uses them.\r\n  * Improve table logging format (it's more precise now).\r\n  * Rename `save_mod_profile` to `dump_mod_profile` (it sends the data to the log, which isn't necessarily saved persistently).\r\n  * Fix code style.\r\n\r\nNote: This somewhat depends on #2628 (it uses the special `none` log level, which was `info` in previous versions).  It could be changed to use `minetest.debug` or similar though.\r\n","created_at":"2015-04-27T01:38:31Z","updated_at":"2015-05-04T15:04:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b0f5027450a509828d6429c582b4bd7348a450c1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/minetest/minetest/pulls/2655/commits","review_comments_url":"https://api.github.com/repos/minetest/minetest/pulls/2655/comments","review_comment_url":"https://api.github.com/repos/minetest/minetest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/minetest/minetest/issues/2655/comments","statuses_url":"https://api.github.com/repos/minetest/minetest/statuses/89d5382f2a27d3b11e2d0ebb2a22eb197d1af171","head":{"label":"ShadowNinja:cleanup-mod-profiler","ref":"cleanup-mod-profiler","sha":"89d5382f2a27d3b11e2d0ebb2a22eb197d1af171","user":{"login":"ShadowNinja","id":3399154,"avatar_url":"https://avatars.githubusercontent.com/u/3399154?v=3","gravatar_id":"","url":"https://api.github.com/users/ShadowNinja","html_url":"https://github.com/ShadowNinja","followers_url":"https://api.github.com/users/ShadowNinja/followers","following_url":"https://api.github.com/users/ShadowNinja/following{/other_user}","gists_url":"https://api.github.com/users/ShadowNinja/gists{/gist_id}","starred_url":"https://api.github.com/users/ShadowNinja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShadowNinja/subscriptions","organizations_url":"https://api.github.com/users/ShadowNinja/orgs","repos_url":"https://api.github.com/users/ShadowNinja/repos","events_url":"https://api.github.com/users/ShadowNinja/events{/privacy}","received_events_url":"https://api.github.com/users/ShadowNinja/received_events","type":"User","site_admin":false},"repo":{"id":8000011,"name":"minetest","full_name":"ShadowNinja/minetest","owner":{"login":"ShadowNinja","id":3399154,"avatar_url":"https://avatars.githubusercontent.com/u/3399154?v=3","gravatar_id":"","url":"https://api.github.com/users/ShadowNinja","html_url":"https://github.com/ShadowNinja","followers_url":"https://api.github.com/users/ShadowNinja/followers","following_url":"https://api.github.com/users/ShadowNinja/following{/other_user}","gists_url":"https://api.github.com/users/ShadowNinja/gists{/gist_id}","starred_url":"https://api.github.com/users/ShadowNinja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShadowNinja/subscriptions","organizations_url":"https://api.github.com/users/ShadowNinja/orgs","repos_url":"https://api.github.com/users/ShadowNinja/repos","events_url":"https://api.github.com/users/ShadowNinja/events{/privacy}","received_events_url":"https://api.github.com/users/ShadowNinja/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ShadowNinja/minetest","description":"Minetest, an open source infinite-world block sandbox game with survival and crafting. This is a private fork, the official repo is @minetest/minetest","fork":true,"url":"https://api.github.com/repos/ShadowNinja/minetest","forks_url":"https://api.github.com/repos/ShadowNinja/minetest/forks","keys_url":"https://api.github.com/repos/ShadowNinja/minetest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ShadowNinja/minetest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ShadowNinja/minetest/teams","hooks_url":"https://api.github.com/repos/ShadowNinja/minetest/hooks","issue_events_url":"https://api.github.com/repos/ShadowNinja/minetest/issues/events{/number}","events_url":"https://api.github.com/repos/ShadowNinja/minetest/events","assignees_url":"https://api.github.com/repos/ShadowNinja/minetest/assignees{/user}","branches_url":"https://api.github.com/repos/ShadowNinja/minetest/branches{/branch}","tags_url":"https://api.github.com/repos/ShadowNinja/minetest/tags","blobs_url":"https://api.github.com/repos/ShadowNinja/minetest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ShadowNinja/minetest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ShadowNinja/minetest/git/refs{/sha}","trees_url":"https://api.github.com/repos/ShadowNinja/minetest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ShadowNinja/minetest/statuses/{sha}","languages_url":"https://api.github.com/repos/ShadowNinja/minetest/languages","stargazers_url":"https://api.github.com/repos/ShadowNinja/minetest/stargazers","contributors_url":"https://api.github.com/repos/ShadowNinja/minetest/contributors","subscribers_url":"https://api.github.com/repos/ShadowNinja/minetest/subscribers","subscription_url":"https://api.github.com/repos/ShadowNinja/minetest/subscription","commits_url":"https://api.github.com/repos/ShadowNinja/minetest/commits{/sha}","git_commits_url":"https://api.github.com/repos/ShadowNinja/minetest/git/commits{/sha}","comments_url":"https://api.github.com/repos/ShadowNinja/minetest/comments{/number}","issue_comment_url":"https://api.github.com/repos/ShadowNinja/minetest/issues/comments{/number}","contents_url":"https://api.github.com/repos/ShadowNinja/minetest/contents/{+path}","compare_url":"https://api.github.com/repos/ShadowNinja/minetest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ShadowNinja/minetest/merges","archive_url":"https://api.github.com/repos/ShadowNinja/minetest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ShadowNinja/minetest/downloads","issues_url":"https://api.github.com/repos/ShadowNinja/minetest/issues{/number}","pulls_url":"https://api.github.com/repos/ShadowNinja/minetest/pulls{/number}","milestones_url":"https://api.github.com/repos/ShadowNinja/minetest/milestones{/number}","notifications_url":"https://api.github.com/repos/ShadowNinja/minetest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ShadowNinja/minetest/labels{/name}","releases_url":"https://api.github.com/repos/ShadowNinja/minetest/releases{/id}","created_at":"2013-02-04T02:44:10Z","updated_at":"2015-02-21T18:17:05Z","pushed_at":"2015-05-01T16:13:17Z","git_url":"git://github.com/ShadowNinja/minetest.git","ssh_url":"git@github.com:ShadowNinja/minetest.git","clone_url":"https://github.com/ShadowNinja/minetest.git","svn_url":"https://github.com/ShadowNinja/minetest","homepage":"http://minetest.net/","size":36272,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"minetest:master","ref":"master","sha":"732eb72a0c4e2fb4632b0f42762d102e0d98dffa","user":{"login":"minetest","id":2624745,"avatar_url":"https://avatars.githubusercontent.com/u/2624745?v=3","gravatar_id":"","url":"https://api.github.com/users/minetest","html_url":"https://github.com/minetest","followers_url":"https://api.github.com/users/minetest/followers","following_url":"https://api.github.com/users/minetest/following{/other_user}","gists_url":"https://api.github.com/users/minetest/gists{/gist_id}","starred_url":"https://api.github.com/users/minetest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minetest/subscriptions","organizations_url":"https://api.github.com/users/minetest/orgs","repos_url":"https://api.github.com/users/minetest/repos","events_url":"https://api.github.com/users/minetest/events{/privacy}","received_events_url":"https://api.github.com/users/minetest/received_events","type":"Organization","site_admin":false},"repo":{"id":2168780,"name":"minetest","full_name":"minetest/minetest","owner":{"login":"minetest","id":2624745,"avatar_url":"https://avatars.githubusercontent.com/u/2624745?v=3","gravatar_id":"","url":"https://api.github.com/users/minetest","html_url":"https://github.com/minetest","followers_url":"https://api.github.com/users/minetest/followers","following_url":"https://api.github.com/users/minetest/following{/other_user}","gists_url":"https://api.github.com/users/minetest/gists{/gist_id}","starred_url":"https://api.github.com/users/minetest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minetest/subscriptions","organizations_url":"https://api.github.com/users/minetest/orgs","repos_url":"https://api.github.com/users/minetest/repos","events_url":"https://api.github.com/users/minetest/events{/privacy}","received_events_url":"https://api.github.com/users/minetest/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/minetest/minetest","description":"Minetest, an open source infinite-world block sandbox game with survival and crafting. [also https://github.com/minetest/minetest_game]","fork":false,"url":"https://api.github.com/repos/minetest/minetest","forks_url":"https://api.github.com/repos/minetest/minetest/forks","keys_url":"https://api.github.com/repos/minetest/minetest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/minetest/minetest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/minetest/minetest/teams","hooks_url":"https://api.github.com/repos/minetest/minetest/hooks","issue_events_url":"https://api.github.com/repos/minetest/minetest/issues/events{/number}","events_url":"https://api.github.com/repos/minetest/minetest/events","assignees_url":"https://api.github.com/repos/minetest/minetest/assignees{/user}","branches_url":"https://api.github.com/repos/minetest/minetest/branches{/branch}","tags_url":"https://api.github.com/repos/minetest/minetest/tags","blobs_url":"https://api.github.com/repos/minetest/minetest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/minetest/minetest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/minetest/minetest/git/refs{/sha}","trees_url":"https://api.github.com/repos/minetest/minetest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/minetest/minetest/statuses/{sha}","languages_url":"https://api.github.com/repos/minetest/minetest/languages","stargazers_url":"https://api.github.com/repos/minetest/minetest/stargazers","contributors_url":"https://api.github.com/repos/minetest/minetest/contributors","subscribers_url":"https://api.github.com/repos/minetest/minetest/subscribers","subscription_url":"https://api.github.com/repos/minetest/minetest/subscription","commits_url":"https://api.github.com/repos/minetest/minetest/commits{/sha}","git_commits_url":"https://api.github.com/repos/minetest/minetest/git/commits{/sha}","comments_url":"https://api.github.com/repos/minetest/minetest/comments{/number}","issue_comment_url":"https://api.github.com/repos/minetest/minetest/issues/comments{/number}","contents_url":"https://api.github.com/repos/minetest/minetest/contents/{+path}","compare_url":"https://api.github.com/repos/minetest/minetest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/minetest/minetest/merges","archive_url":"https://api.github.com/repos/minetest/minetest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/minetest/minetest/downloads","issues_url":"https://api.github.com/repos/minetest/minetest/issues{/number}","pulls_url":"https://api.github.com/repos/minetest/minetest/pulls{/number}","milestones_url":"https://api.github.com/repos/minetest/minetest/milestones{/number}","notifications_url":"https://api.github.com/repos/minetest/minetest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/minetest/minetest/labels{/name}","releases_url":"https://api.github.com/repos/minetest/minetest/releases{/id}","created_at":"2011-08-07T13:48:36Z","updated_at":"2015-05-04T13:58:58Z","pushed_at":"2015-05-04T10:26:32Z","git_url":"git://github.com/minetest/minetest.git","ssh_url":"git@github.com:minetest/minetest.git","clone_url":"https://github.com/minetest/minetest.git","svn_url":"https://github.com/minetest/minetest","homepage":"http://minetest.net/","size":88341,"stargazers_count":1466,"watchers_count":1466,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":483,"mirror_url":null,"open_issues_count":496,"forks":483,"open_issues":496,"watchers":1466,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/minetest/minetest/pulls/2655"},"html":{"href":"https://github.com/minetest/minetest/pull/2655"},"issue":{"href":"https://api.github.com/repos/minetest/minetest/issues/2655"},"comments":{"href":"https://api.github.com/repos/minetest/minetest/issues/2655/comments"},"review_comments":{"href":"https://api.github.com/repos/minetest/minetest/pulls/2655/comments"},"review_comment":{"href":"https://api.github.com/repos/minetest/minetest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/minetest/minetest/pulls/2655/commits"},"statuses":{"href":"https://api.github.com/repos/minetest/minetest/statuses/89d5382f2a27d3b11e2d0ebb2a22eb197d1af171"}}}}