{"action":"created","issue":{"url":"https://api.github.com/repos/erkyrath/quixe/issues/6","labels_url":"https://api.github.com/repos/erkyrath/quixe/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/erkyrath/quixe/issues/6/comments","events_url":"https://api.github.com/repos/erkyrath/quixe/issues/6/events","html_url":"https://github.com/erkyrath/quixe/issues/6","id":78311518,"number":6,"title":"VM's reliance on closures makes it 3× slower","user":{"login":"eevee","id":94112,"avatar_url":"https://avatars.githubusercontent.com/u/94112?v=3","gravatar_id":"","url":"https://api.github.com/users/eevee","html_url":"https://github.com/eevee","followers_url":"https://api.github.com/users/eevee/followers","following_url":"https://api.github.com/users/eevee/following{/other_user}","gists_url":"https://api.github.com/users/eevee/gists{/gist_id}","starred_url":"https://api.github.com/users/eevee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eevee/subscriptions","organizations_url":"https://api.github.com/users/eevee/orgs","repos_url":"https://api.github.com/users/eevee/repos","events_url":"https://api.github.com/users/eevee/events{/privacy}","received_events_url":"https://api.github.com/users/eevee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-05-20T00:48:40Z","updated_at":"2015-05-29T04:51:05Z","closed_at":null,"body":"V8, and most likely other JavaScript VMs, won't optimize a function if it relies on reading variables from outer scopes.  Virtually everything in the Quixe VM works this way.  (Chrome's profiler will tell you when a function is unoptimized, and why.)\r\n\r\nI have a travesty of a branch where I shoved most of the state into a `vm` object that gets passed around, and turned everything into a method.  I tried loading Emily Short's Counterfeit Monkey, which does a lot of intensive work at startup.  Load time dropped from 29.4 seconds to 10.4 seconds, as measured by the \"done executing; path time = ...\" console log."},"comment":{"url":"https://api.github.com/repos/erkyrath/quixe/issues/comments/106684448","html_url":"https://github.com/erkyrath/quixe/issues/6#issuecomment-106684448","issue_url":"https://api.github.com/repos/erkyrath/quixe/issues/6","id":106684448,"user":{"login":"erkyrath","id":65666,"avatar_url":"https://avatars.githubusercontent.com/u/65666?v=3","gravatar_id":"","url":"https://api.github.com/users/erkyrath","html_url":"https://github.com/erkyrath","followers_url":"https://api.github.com/users/erkyrath/followers","following_url":"https://api.github.com/users/erkyrath/following{/other_user}","gists_url":"https://api.github.com/users/erkyrath/gists{/gist_id}","starred_url":"https://api.github.com/users/erkyrath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erkyrath/subscriptions","organizations_url":"https://api.github.com/users/erkyrath/orgs","repos_url":"https://api.github.com/users/erkyrath/repos","events_url":"https://api.github.com/users/erkyrath/events{/privacy}","received_events_url":"https://api.github.com/users/erkyrath/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T04:51:05Z","updated_at":"2015-05-29T04:51:05Z","body":"I checked in one more change (in noeval) which uses an explicit \"self\" argument instead of the .bind(self) call.\r\n\r\nThis seems to be the crucial bit. I now get 65% improvement in Safari, 55% in Chrome, 10% in Firefox. (Again comparing with the 2.1.0 release.) So we're all in the black now.\r\n"}}