{"action":"closed","number":105,"pull_request":{"url":"https://api.github.com/repos/peterbe/premailer/pulls/105","id":29324211,"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","issue_url":"https://api.github.com/repos/peterbe/premailer/issues/105","number":105,"state":"closed","locked":false,"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},"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 ","created_at":"2015-02-14T19:11:03Z","updated_at":"2015-02-18T00:16:11Z","closed_at":"2015-02-18T00:16:11Z","merged_at":null,"merge_commit_sha":"ff35cf382e4d1ce9c549d5d00efb3a89186ee14e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/peterbe/premailer/pulls/105/commits","review_comments_url":"https://api.github.com/repos/peterbe/premailer/pulls/105/comments","review_comment_url":"https://api.github.com/repos/peterbe/premailer/pulls/comments/{number}","comments_url":"https://api.github.com/repos/peterbe/premailer/issues/105/comments","statuses_url":"https://api.github.com/repos/peterbe/premailer/statuses/dfa2889f60f569d1feb435169f391b9d97776cf8","head":{"label":"michaeljones:caching","ref":"caching","sha":"dfa2889f60f569d1feb435169f391b9d97776cf8","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},"repo":{"id":30805629,"name":"premailer","full_name":"michaeljones/premailer","owner":{"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},"private":false,"html_url":"https://github.com/michaeljones/premailer","description":"Turns CSS blocks into style attributes","fork":true,"url":"https://api.github.com/repos/michaeljones/premailer","forks_url":"https://api.github.com/repos/michaeljones/premailer/forks","keys_url":"https://api.github.com/repos/michaeljones/premailer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/michaeljones/premailer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/michaeljones/premailer/teams","hooks_url":"https://api.github.com/repos/michaeljones/premailer/hooks","issue_events_url":"https://api.github.com/repos/michaeljones/premailer/issues/events{/number}","events_url":"https://api.github.com/repos/michaeljones/premailer/events","assignees_url":"https://api.github.com/repos/michaeljones/premailer/assignees{/user}","branches_url":"https://api.github.com/repos/michaeljones/premailer/branches{/branch}","tags_url":"https://api.github.com/repos/michaeljones/premailer/tags","blobs_url":"https://api.github.com/repos/michaeljones/premailer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/michaeljones/premailer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/michaeljones/premailer/git/refs{/sha}","trees_url":"https://api.github.com/repos/michaeljones/premailer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/michaeljones/premailer/statuses/{sha}","languages_url":"https://api.github.com/repos/michaeljones/premailer/languages","stargazers_url":"https://api.github.com/repos/michaeljones/premailer/stargazers","contributors_url":"https://api.github.com/repos/michaeljones/premailer/contributors","subscribers_url":"https://api.github.com/repos/michaeljones/premailer/subscribers","subscription_url":"https://api.github.com/repos/michaeljones/premailer/subscription","commits_url":"https://api.github.com/repos/michaeljones/premailer/commits{/sha}","git_commits_url":"https://api.github.com/repos/michaeljones/premailer/git/commits{/sha}","comments_url":"https://api.github.com/repos/michaeljones/premailer/comments{/number}","issue_comment_url":"https://api.github.com/repos/michaeljones/premailer/issues/comments/{number}","contents_url":"https://api.github.com/repos/michaeljones/premailer/contents/{+path}","compare_url":"https://api.github.com/repos/michaeljones/premailer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/michaeljones/premailer/merges","archive_url":"https://api.github.com/repos/michaeljones/premailer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/michaeljones/premailer/downloads","issues_url":"https://api.github.com/repos/michaeljones/premailer/issues{/number}","pulls_url":"https://api.github.com/repos/michaeljones/premailer/pulls{/number}","milestones_url":"https://api.github.com/repos/michaeljones/premailer/milestones{/number}","notifications_url":"https://api.github.com/repos/michaeljones/premailer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/michaeljones/premailer/labels{/name}","releases_url":"https://api.github.com/repos/michaeljones/premailer/releases{/id}","created_at":"2015-02-14T19:02:20Z","updated_at":"2015-02-14T19:02:20Z","pushed_at":"2015-02-15T09:28:34Z","git_url":"git://github.com/michaeljones/premailer.git","ssh_url":"git@github.com:michaeljones/premailer.git","clone_url":"https://github.com/michaeljones/premailer.git","svn_url":"https://github.com/michaeljones/premailer","homepage":"http://www.peterbe.com/plog/premailer.py","size":1187,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"peterbe:master","ref":"master","sha":"1c32eef00f4b29f973531c41f10ca2ca6bd3b9b6","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},"repo":{"id":251729,"name":"premailer","full_name":"peterbe/premailer","owner":{"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},"private":false,"html_url":"https://github.com/peterbe/premailer","description":"Turns CSS blocks into style attributes","fork":false,"url":"https://api.github.com/repos/peterbe/premailer","forks_url":"https://api.github.com/repos/peterbe/premailer/forks","keys_url":"https://api.github.com/repos/peterbe/premailer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/peterbe/premailer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/peterbe/premailer/teams","hooks_url":"https://api.github.com/repos/peterbe/premailer/hooks","issue_events_url":"https://api.github.com/repos/peterbe/premailer/issues/events{/number}","events_url":"https://api.github.com/repos/peterbe/premailer/events","assignees_url":"https://api.github.com/repos/peterbe/premailer/assignees{/user}","branches_url":"https://api.github.com/repos/peterbe/premailer/branches{/branch}","tags_url":"https://api.github.com/repos/peterbe/premailer/tags","blobs_url":"https://api.github.com/repos/peterbe/premailer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/peterbe/premailer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/peterbe/premailer/git/refs{/sha}","trees_url":"https://api.github.com/repos/peterbe/premailer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/peterbe/premailer/statuses/{sha}","languages_url":"https://api.github.com/repos/peterbe/premailer/languages","stargazers_url":"https://api.github.com/repos/peterbe/premailer/stargazers","contributors_url":"https://api.github.com/repos/peterbe/premailer/contributors","subscribers_url":"https://api.github.com/repos/peterbe/premailer/subscribers","subscription_url":"https://api.github.com/repos/peterbe/premailer/subscription","commits_url":"https://api.github.com/repos/peterbe/premailer/commits{/sha}","git_commits_url":"https://api.github.com/repos/peterbe/premailer/git/commits{/sha}","comments_url":"https://api.github.com/repos/peterbe/premailer/comments{/number}","issue_comment_url":"https://api.github.com/repos/peterbe/premailer/issues/comments/{number}","contents_url":"https://api.github.com/repos/peterbe/premailer/contents/{+path}","compare_url":"https://api.github.com/repos/peterbe/premailer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/peterbe/premailer/merges","archive_url":"https://api.github.com/repos/peterbe/premailer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/peterbe/premailer/downloads","issues_url":"https://api.github.com/repos/peterbe/premailer/issues{/number}","pulls_url":"https://api.github.com/repos/peterbe/premailer/pulls{/number}","milestones_url":"https://api.github.com/repos/peterbe/premailer/milestones{/number}","notifications_url":"https://api.github.com/repos/peterbe/premailer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/peterbe/premailer/labels{/name}","releases_url":"https://api.github.com/repos/peterbe/premailer/releases{/id}","created_at":"2009-07-15T10:59:28Z","updated_at":"2015-02-15T23:01:23Z","pushed_at":"2015-01-10T21:46:33Z","git_url":"git://github.com/peterbe/premailer.git","ssh_url":"git@github.com:peterbe/premailer.git","clone_url":"https://github.com/peterbe/premailer.git","svn_url":"https://github.com/peterbe/premailer","homepage":"http://www.peterbe.com/plog/premailer.py","size":1187,"stargazers_count":365,"watchers_count":365,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":94,"mirror_url":null,"open_issues_count":28,"forks":94,"open_issues":28,"watchers":365,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/peterbe/premailer/pulls/105"},"html":{"href":"https://github.com/peterbe/premailer/pull/105"},"issue":{"href":"https://api.github.com/repos/peterbe/premailer/issues/105"},"comments":{"href":"https://api.github.com/repos/peterbe/premailer/issues/105/comments"},"review_comments":{"href":"https://api.github.com/repos/peterbe/premailer/pulls/105/comments"},"review_comment":{"href":"https://api.github.com/repos/peterbe/premailer/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/peterbe/premailer/pulls/105/commits"},"statuses":{"href":"https://api.github.com/repos/peterbe/premailer/statuses/dfa2889f60f569d1feb435169f391b9d97776cf8"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":10,"review_comments":0,"commits":8,"additions":2820,"deletions":10,"changed_files":4}}