{"action":"created","issue":{"url":"https://api.github.com/repos/peterbe/premailer/issues/105","labels_url":"https://api.github.com/repos/peterbe/premailer/issues/105/labels{/name}","comments_url":"https://api.github.com/repos/peterbe/premailer/issues/105/comments","events_url":"https://api.github.com/repos/peterbe/premailer/issues/105/events","html_url":"https://github.com/peterbe/premailer/pull/105","id":57703132,"number":105,"title":"Caching","user":{"login":"michaeljones","id":5390,"avatar_url":"https://avatars.githubusercontent.com/u/5390?v=3","gravatar_id":"","url":"https://api.github.com/users/michaeljones","html_url":"https://github.com/michaeljones","followers_url":"https://api.github.com/users/michaeljones/followers","following_url":"https://api.github.com/users/michaeljones/following{/other_user}","gists_url":"https://api.github.com/users/michaeljones/gists{/gist_id}","starred_url":"https://api.github.com/users/michaeljones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaeljones/subscriptions","organizations_url":"https://api.github.com/users/michaeljones/orgs","repos_url":"https://api.github.com/users/michaeljones/repos","events_url":"https://api.github.com/users/michaeljones/events{/privacy}","received_events_url":"https://api.github.com/users/michaeljones/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-02-14T19:11:03Z","updated_at":"2015-02-18T00:16:11Z","closed_at":"2015-02-18T00:16:11Z","pull_request":{"url":"https://api.github.com/repos/peterbe/premailer/pulls/105","html_url":"https://github.com/peterbe/premailer/pull/105","diff_url":"https://github.com/peterbe/premailer/pull/105.diff","patch_url":"https://github.com/peterbe/premailer/pull/105.patch"},"body":"Hi,\r\n\r\nI have a production use of premailer that is going quite slowly. Looking at the code, I thought to introduce some caching to avoid re-parsing the CSS text. I've introduced a test case which is a little bulkier than your other ones and added a test which checks the result and the time required to transforms the html.\r\n\r\nWithout caching it takes 16.4 seconds.\r\nWith caching it takes 1.33 seconds.\r\n\r\nI think this is a good addition to the code and, though I'm aware that caching is a space vs time trade off, I don't think that the extra memory in this situation should be a serious concern. I haven't done any tests to prove that though.\r\n\r\nThe commit `Add compare method to test` attempts to resolve an unused variable warning from one of the tests. It is unrelated to the main changes and can easily be dropped if I misread the situation.\r\n\r\nCheers,\r\nMichael "},"comment":{"url":"https://api.github.com/repos/peterbe/premailer/issues/comments/74784839","html_url":"https://github.com/peterbe/premailer/pull/105#issuecomment-74784839","issue_url":"https://api.github.com/repos/peterbe/premailer/issues/105","id":74784839,"user":{"login":"peterbe","id":26739,"avatar_url":"https://avatars.githubusercontent.com/u/26739?v=3","gravatar_id":"","url":"https://api.github.com/users/peterbe","html_url":"https://github.com/peterbe","followers_url":"https://api.github.com/users/peterbe/followers","following_url":"https://api.github.com/users/peterbe/following{/other_user}","gists_url":"https://api.github.com/users/peterbe/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbe/subscriptions","organizations_url":"https://api.github.com/users/peterbe/orgs","repos_url":"https://api.github.com/users/peterbe/repos","events_url":"https://api.github.com/users/peterbe/events{/privacy}","received_events_url":"https://api.github.com/users/peterbe/received_events","type":"User","site_admin":false},"created_at":"2015-02-18T00:16:11Z","updated_at":"2015-02-18T00:16:11Z","body":"@michaeljones I think @vanng822 's PR blows away the problem. It really does work and passes all the tests. If you don't mind, I'm going to close this PR. Let's all head over to #107 and get that landed. "}}