{"action":"created","issue":{"url":"https://api.github.com/repos/marionettejs/marionette.inspector/issues/278","labels_url":"https://api.github.com/repos/marionettejs/marionette.inspector/issues/278/labels{/name}","comments_url":"https://api.github.com/repos/marionettejs/marionette.inspector/issues/278/comments","events_url":"https://api.github.com/repos/marionettejs/marionette.inspector/issues/278/events","html_url":"https://github.com/marionettejs/marionette.inspector/issues/278","id":68202230,"number":278,"title":"Agent.send() should use lazyWorker","user":{"login":"ianmstew","id":4119765,"avatar_url":"https://avatars.githubusercontent.com/u/4119765?v=3","gravatar_id":"","url":"https://api.github.com/users/ianmstew","html_url":"https://github.com/ianmstew","followers_url":"https://api.github.com/users/ianmstew/followers","following_url":"https://api.github.com/users/ianmstew/following{/other_user}","gists_url":"https://api.github.com/users/ianmstew/gists{/gist_id}","starred_url":"https://api.github.com/users/ianmstew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianmstew/subscriptions","organizations_url":"https://api.github.com/users/ianmstew/orgs","repos_url":"https://api.github.com/users/ianmstew/repos","events_url":"https://api.github.com/users/ianmstew/events{/privacy}","received_events_url":"https://api.github.com/users/ianmstew/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-13T21:47:45Z","updated_at":"2015-04-13T23:19:57Z","closed_at":"2015-04-13T22:36:59Z","body":"Executing a deep `show()` cycle with Marionette.Inspector running revealed a long (500ms) \"flat line\" on the CPU profiler.  Closer inspection shows `agent.send()` to be 100% responsible for this flat line.  See below.\r\n\r\n```js\r\n    send: function() {\r\n      // console.log('!!!! sending batch message')\r\n      debug.log('postMessage sent ' + this.queue.length + ' messages.');\r\n//       Agent.lazyWorker.send({\r\n//         function: window.postMessage, \r\n//         context: window,\r\n//         data: _.clone(this.queue)\r\n//       })\r\n      window.postMessage(this.queue, '*');\r\n      this.queue = [];\r\n    }\r\n```\r\n\r\n![screen shot 2015-04-13 at 5 44 25 pm](https://cloud.githubusercontent.com/assets/4119765/7126137/d6aaf55c-e204-11e4-8870-89bc834c0248.png)"},"comment":{"url":"https://api.github.com/repos/marionettejs/marionette.inspector/issues/comments/92531491","html_url":"https://github.com/marionettejs/marionette.inspector/issues/278#issuecomment-92531491","issue_url":"https://api.github.com/repos/marionettejs/marionette.inspector/issues/278","id":92531491,"user":{"login":"ianmstew","id":4119765,"avatar_url":"https://avatars.githubusercontent.com/u/4119765?v=3","gravatar_id":"","url":"https://api.github.com/users/ianmstew","html_url":"https://github.com/ianmstew","followers_url":"https://api.github.com/users/ianmstew/followers","following_url":"https://api.github.com/users/ianmstew/following{/other_user}","gists_url":"https://api.github.com/users/ianmstew/gists{/gist_id}","starred_url":"https://api.github.com/users/ianmstew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianmstew/subscriptions","organizations_url":"https://api.github.com/users/ianmstew/orgs","repos_url":"https://api.github.com/users/ianmstew/repos","events_url":"https://api.github.com/users/ianmstew/events{/privacy}","received_events_url":"https://api.github.com/users/ianmstew/received_events","type":"User","site_admin":false},"created_at":"2015-04-13T23:19:57Z","updated_at":"2015-04-13T23:19:57Z","body":"You nailed it.  Flatline gone; the same show cycle 1.3 seconds instead of 2.0.  Now that's money.\r\n\r\n![screen shot 2015-04-13 at 7 18 58 pm](https://cloud.githubusercontent.com/assets/4119765/7127412/fd86158c-e211-11e4-8667-f97349a4a779.png)\r\n"}}