{"action":"created","issue":{"url":"https://api.github.com/repos/MOARdV/AvionicsSystems/issues/5","repository_url":"https://api.github.com/repos/MOARdV/AvionicsSystems","labels_url":"https://api.github.com/repos/MOARdV/AvionicsSystems/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/MOARdV/AvionicsSystems/issues/5/comments","events_url":"https://api.github.com/repos/MOARdV/AvionicsSystems/issues/5/events","html_url":"https://github.com/MOARdV/AvionicsSystems/issues/5","id":171007431,"number":5,"title":"MoonSharp Performance (and Garbage Creation) issues","user":{"login":"MOARdV","id":6089493,"avatar_url":"https://avatars.githubusercontent.com/u/6089493?v=3","gravatar_id":"","url":"https://api.github.com/users/MOARdV","html_url":"https://github.com/MOARdV","followers_url":"https://api.github.com/users/MOARdV/followers","following_url":"https://api.github.com/users/MOARdV/following{/other_user}","gists_url":"https://api.github.com/users/MOARdV/gists{/gist_id}","starred_url":"https://api.github.com/users/MOARdV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MOARdV/subscriptions","organizations_url":"https://api.github.com/users/MOARdV/orgs","repos_url":"https://api.github.com/users/MOARdV/repos","events_url":"https://api.github.com/users/MOARdV/events{/privacy}","received_events_url":"https://api.github.com/users/MOARdV/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/MOARdV/AvionicsSystems/labels/internal","name":"internal","color":"d4c5f9"}],"state":"open","locked":false,"assignee":{"login":"MOARdV","id":6089493,"avatar_url":"https://avatars.githubusercontent.com/u/6089493?v=3","gravatar_id":"","url":"https://api.github.com/users/MOARdV","html_url":"https://github.com/MOARdV","followers_url":"https://api.github.com/users/MOARdV/followers","following_url":"https://api.github.com/users/MOARdV/following{/other_user}","gists_url":"https://api.github.com/users/MOARdV/gists{/gist_id}","starred_url":"https://api.github.com/users/MOARdV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MOARdV/subscriptions","organizations_url":"https://api.github.com/users/MOARdV/orgs","repos_url":"https://api.github.com/users/MOARdV/repos","events_url":"https://api.github.com/users/MOARdV/events{/privacy}","received_events_url":"https://api.github.com/users/MOARdV/received_events","type":"User","site_admin":false},"assignees":[{"login":"MOARdV","id":6089493,"avatar_url":"https://avatars.githubusercontent.com/u/6089493?v=3","gravatar_id":"","url":"https://api.github.com/users/MOARdV","html_url":"https://github.com/MOARdV","followers_url":"https://api.github.com/users/MOARdV/followers","following_url":"https://api.github.com/users/MOARdV/following{/other_user}","gists_url":"https://api.github.com/users/MOARdV/gists{/gist_id}","starred_url":"https://api.github.com/users/MOARdV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MOARdV/subscriptions","organizations_url":"https://api.github.com/users/MOARdV/orgs","repos_url":"https://api.github.com/users/MOARdV/repos","events_url":"https://api.github.com/users/MOARdV/events{/privacy}","received_events_url":"https://api.github.com/users/MOARdV/received_events","type":"User","site_admin":false}],"milestone":null,"comments":8,"created_at":"2016-08-13T12:43:32Z","updated_at":"2016-10-13T19:49:24Z","closed_at":null,"body":"Now that I've got MAS working well enough to operate most of an IVA, I'm getting some realistic performance results showing the cost of the MoonSharp Lua interpreter,\r\n\r\nWith 129 \"variables\", many of them using the simple \"fc.GetVariable()\" form, the FixedUpdate takes 1.73ms (with a millisecond-resolution timer - need to see if there is a higher precision option).  That's about 1/10 of the FixedUpdate interval, which means it's too slow.\r\n\r\nStrategies to consider:\r\n\r\n1) Dynamic scaling of the update.  Right now, MAS updates every variable every FixedUpdate, which makes everything *very* responsive (other than the yellow-timer lag occasionally).  I could put together a heuristic that 'load balances' the updates by splitting them up into groups, and updating each group in a round-robin fashion.  This will reduce the responsiveness of the variables, but that's been a 'feature' in RPM for a while.\r\n\r\n2) Selective use of Lua.  MAS makes every variable a Lua microscript.  If I write a basic parser (yuck), I can decompose a variable and figure out which ones are simple wrappers around callbacks to the proxy classes.  Instead of round-tripping through Lua, I can split the simple cases out and use delegates.  It complicates initializing a variable, but it will cut the cost of updating it, which is the important issue.\r\n\r\n3) Dig into the MoonSharp code.  Branch the code and see if I can find where the garbage is being generated.  Get some advice from some of the more C#-savvy modders on where the large !/$ areas are.\r\n\r\nUltimately, I am sure I'll try 1 and 2; there is the additional note that there is only so much I can realistically do, since Lua is an interpreted language, so it will be slower than pure C#.  I suppose there's always trying to do something like learning IL and seeing if I can write a Lua->IL transformation, but that's way down the road when I get bored..."},"comment":{"url":"https://api.github.com/repos/MOARdV/AvionicsSystems/issues/comments/253619438","html_url":"https://github.com/MOARdV/AvionicsSystems/issues/5#issuecomment-253619438","issue_url":"https://api.github.com/repos/MOARdV/AvionicsSystems/issues/5","id":253619438,"user":{"login":"MOARdV","id":6089493,"avatar_url":"https://avatars.githubusercontent.com/u/6089493?v=3","gravatar_id":"","url":"https://api.github.com/users/MOARdV","html_url":"https://github.com/MOARdV","followers_url":"https://api.github.com/users/MOARdV/followers","following_url":"https://api.github.com/users/MOARdV/following{/other_user}","gists_url":"https://api.github.com/users/MOARdV/gists{/gist_id}","starred_url":"https://api.github.com/users/MOARdV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MOARdV/subscriptions","organizations_url":"https://api.github.com/users/MOARdV/orgs","repos_url":"https://api.github.com/users/MOARdV/repos","events_url":"https://api.github.com/users/MOARdV/events{/privacy}","received_events_url":"https://api.github.com/users/MOARdV/received_events","type":"User","site_admin":false},"created_at":"2016-10-13T19:49:24Z","updated_at":"2016-10-13T19:49:24Z","body":"Hacking in code that generates one mega-function to update all the variables has no impact on performance and garbage creation - the problem is in Lua interpretation, and not Lua \"context\" entry/exit"}}
{"actor":{"display_login":"MOARdV"}}