{"action":"created","comment":{"url":"https://api.github.com/repos/xitu/gold-miner/pulls/comments/53737403","id":53737403,"diff_hunk":"@@ -5,68 +5,67 @@\n * 校对者: \n * 状态 :  待定\n \n-Your Facebook News Feed is filled with photos of your friends, family, and loved ones — photos you may want to view on your phone. We are always looking for ways to make things better and faster for mobile. So, our team took a look at how we can make photos faster on iOS and we found a way to reduce the data used by Facebook for iOS by about 10% and show a good image 15% faster than before. Here's how we did it.\n+你的Facebook的动态消息中总是充满了那些你想要在手机上看的照片。照片里有可能是你的朋友，家人甚至是你最爱的人。我们一直在寻找提升用户体验的方式，包括更优秀和更快的移动端体验。为了达到这个目标，我们的团队仔细查看了我们如何在iOS设备上更好的显示照片并且我们找到了一种能够让Facebook在iOS系统中减少数据占用10%的方法而且同时还能加载图片的速度比以前提升15%。接下来是我们如何做到这一点的。\n \n-## How photos used to work\n+## 过去图片是如何被处理的\n \n-Up until now, Facebook for iOS app has loaded your photos in News Feed as follows:\n+直到现在，iOS端上的Facebook已经按照下列的要求在用户的动态消息更好的加载照片：\n \n-*   Photo URLs were downloaded first, and then are used to download the actual photo data in JPEG format.\n-*   At least two versions of the image were fetched in parallel, a small one and a full-size one. As soon as we have the smaller one, we show it until the larger, more detailed one is available.\n-*   Sometimes we download the same photos multiple times in different sizes. The sizes depend on the type of device being used or where in the app it appears (e.g. News Feed or the fullscreen photo viewer).\n-*   Every image we download is cached to disk. Since we downloaded multiple image sizes for each photo, multiple sizes of the same image were often stored on disk.\n+*   照片的链接为最先下载，之后再用它来下载JPEG格式的真实大小照片\n+*   至少有2个版本的同一张图片被使用，这包括一张缩略图和一张全尺寸的图片。一旦小的缩略图下载好之后，我们会先显示小的缩略图直到更高精度的图片能被用于展示。\n+*   有时候我们会多次下载同一张图片的不同尺寸。在不同设备的型号和在不同的场景下（比如在动态消息当中或者是全屏显示图片），被使用的尺寸也是不同的。\n+*   所有被下载的图片都是被储存到硬盘的。因为我们下载同一张图片不同尺寸大小的图片，所以多个尺寸的同一张图片通常都被储存在用户的硬盘中\n \n-## Progressive JPEG\n+## 渐进式图片\n \n-Progressive JPEG (PJPEG) is an image format that stores multiple, individual “scans” of a photo, each with an increasing level of detail. When put together, the scans create a full-quality image. The first scan gives a very low-quality representation of the image, and each following scan further increases the level of detail and quality. When images are downloaded using PJPEG, we can render the image as soon as we have the the first scan. As later scans come through, we update the image and re-render it at higher and higher quality.\n+渐进式图片Progressive JEPG（简称为PJEPG）是一种储存多个独立的扫描的图片格式。并且图片的精度会随着扫描的次数增加，变的越来越清晰。当所有的扫描版本叠加之后，一张最高精度的图片就会被显示出来。第一次的扫描能给予用户第一个低质量的缩略图。之后的每一层扫描都会使得这张图片的精度上升一个等级。当图片以PJPEG的格式被下载的时候，一旦第一层扫描结束我们可以马上在手机上为用户显示缩略图。当之后的扫描被下载后，我们会更新图片到一个更好的质量。\n \n-Support for PJPEG became popular in browsers in 2010, and we've been serving photos as PJPEGs for a while now. However, mobile apps haven't really caught up yet. For example, there is currently no out-of-the-box support on iOS for rendering images progressively, so we had to build our own for the Facebook app.\n+游览器对于PJEPG格式图片的支持在2010的时候就已经非常流行了。并且我们已经用PJEPG作为图片储存有一段时间了。然而，手机端的应用们似乎还没赶上这个潮流。举个例子，iOS端上还没有渐进式处理图片的支持，所以我们不得不为在iOS上的Facebook开发新的方式来做到这一点。\n \n-## Using PJPEG in Facebook for iOS\n+## 在Facebook的iOS客户端上用渐进式图片\n \n-Rendering images progressively in the Facebook app has some advantages:\n+在Facebook这个应用中，渐进式的图片推送在以下几个方面有不同的好处：","path":"TODO/faster-photos-in-facebook-for-ios.md","position":35,"original_position":35,"commit_id":"571c458373ca1be47c115d748077b0658f9ef9fa","original_commit_id":"571c458373ca1be47c115d748077b0658f9ef9fa","user":{"login":"SatanWoo","id":1303079,"avatar_url":"https://avatars.githubusercontent.com/u/1303079?v=3","gravatar_id":"","url":"https://api.github.com/users/SatanWoo","html_url":"https://github.com/SatanWoo","followers_url":"https://api.github.com/users/SatanWoo/followers","following_url":"https://api.github.com/users/SatanWoo/following{/other_user}","gists_url":"https://api.github.com/users/SatanWoo/gists{/gist_id}","starred_url":"https://api.github.com/users/SatanWoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SatanWoo/subscriptions","organizations_url":"https://api.github.com/users/SatanWoo/orgs","repos_url":"https://api.github.com/users/SatanWoo/repos","events_url":"https://api.github.com/users/SatanWoo/events{/privacy}","received_events_url":"https://api.github.com/users/SatanWoo/received_events","type":"User","site_admin":false},"body":"在Facebook for iOS中采用渐进式的图片渲染有如下一些好处：","created_at":"2016-02-23T05:20:31Z","updated_at":"2016-02-23T05:20:31Z","html_url":"https://github.com/xitu/gold-miner/pull/115#discussion_r53737403","pull_request_url":"https://api.github.com/repos/xitu/gold-miner/pulls/115","_links":{"self":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/comments/53737403"},"html":{"href":"https://github.com/xitu/gold-miner/pull/115#discussion_r53737403"},"pull_request":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/115"}}},"pull_request":{"url":"https://api.github.com/repos/xitu/gold-miner/pulls/115","id":59951053,"html_url":"https://github.com/xitu/gold-miner/pull/115","diff_url":"https://github.com/xitu/gold-miner/pull/115.diff","patch_url":"https://github.com/xitu/gold-miner/pull/115.patch","issue_url":"https://api.github.com/repos/xitu/gold-miner/issues/115","number":115,"state":"open","locked":false,"title":"完成对FB在iOS上照片处理","user":{"login":"bobmayuze","id":14257524,"avatar_url":"https://avatars.githubusercontent.com/u/14257524?v=3","gravatar_id":"","url":"https://api.github.com/users/bobmayuze","html_url":"https://github.com/bobmayuze","followers_url":"https://api.github.com/users/bobmayuze/followers","following_url":"https://api.github.com/users/bobmayuze/following{/other_user}","gists_url":"https://api.github.com/users/bobmayuze/gists{/gist_id}","starred_url":"https://api.github.com/users/bobmayuze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobmayuze/subscriptions","organizations_url":"https://api.github.com/users/bobmayuze/orgs","repos_url":"https://api.github.com/users/bobmayuze/repos","events_url":"https://api.github.com/users/bobmayuze/events{/privacy}","received_events_url":"https://api.github.com/users/bobmayuze/received_events","type":"User","site_admin":false},"body":"RT，完成翻译","created_at":"2016-02-19T13:47:29Z","updated_at":"2016-02-23T05:20:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8514efd6077a2d3554bfa948e0862ff4c3618899","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/xitu/gold-miner/pulls/115/commits","review_comments_url":"https://api.github.com/repos/xitu/gold-miner/pulls/115/comments","review_comment_url":"https://api.github.com/repos/xitu/gold-miner/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xitu/gold-miner/issues/115/comments","statuses_url":"https://api.github.com/repos/xitu/gold-miner/statuses/571c458373ca1be47c115d748077b0658f9ef9fa","head":{"label":"bobmayuze:BobMa","ref":"BobMa","sha":"571c458373ca1be47c115d748077b0658f9ef9fa","user":{"login":"bobmayuze","id":14257524,"avatar_url":"https://avatars.githubusercontent.com/u/14257524?v=3","gravatar_id":"","url":"https://api.github.com/users/bobmayuze","html_url":"https://github.com/bobmayuze","followers_url":"https://api.github.com/users/bobmayuze/followers","following_url":"https://api.github.com/users/bobmayuze/following{/other_user}","gists_url":"https://api.github.com/users/bobmayuze/gists{/gist_id}","starred_url":"https://api.github.com/users/bobmayuze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobmayuze/subscriptions","organizations_url":"https://api.github.com/users/bobmayuze/orgs","repos_url":"https://api.github.com/users/bobmayuze/repos","events_url":"https://api.github.com/users/bobmayuze/events{/privacy}","received_events_url":"https://api.github.com/users/bobmayuze/received_events","type":"User","site_admin":false},"repo":{"id":48584581,"name":"gold-miner","full_name":"bobmayuze/gold-miner","owner":{"login":"bobmayuze","id":14257524,"avatar_url":"https://avatars.githubusercontent.com/u/14257524?v=3","gravatar_id":"","url":"https://api.github.com/users/bobmayuze","html_url":"https://github.com/bobmayuze","followers_url":"https://api.github.com/users/bobmayuze/followers","following_url":"https://api.github.com/users/bobmayuze/following{/other_user}","gists_url":"https://api.github.com/users/bobmayuze/gists{/gist_id}","starred_url":"https://api.github.com/users/bobmayuze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobmayuze/subscriptions","organizations_url":"https://api.github.com/users/bobmayuze/orgs","repos_url":"https://api.github.com/users/bobmayuze/repos","events_url":"https://api.github.com/users/bobmayuze/events{/privacy}","received_events_url":"https://api.github.com/users/bobmayuze/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bobmayuze/gold-miner","description":"掘金翻译计划，翻译掘金上优质的英文文章","fork":true,"url":"https://api.github.com/repos/bobmayuze/gold-miner","forks_url":"https://api.github.com/repos/bobmayuze/gold-miner/forks","keys_url":"https://api.github.com/repos/bobmayuze/gold-miner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bobmayuze/gold-miner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bobmayuze/gold-miner/teams","hooks_url":"https://api.github.com/repos/bobmayuze/gold-miner/hooks","issue_events_url":"https://api.github.com/repos/bobmayuze/gold-miner/issues/events{/number}","events_url":"https://api.github.com/repos/bobmayuze/gold-miner/events","assignees_url":"https://api.github.com/repos/bobmayuze/gold-miner/assignees{/user}","branches_url":"https://api.github.com/repos/bobmayuze/gold-miner/branches{/branch}","tags_url":"https://api.github.com/repos/bobmayuze/gold-miner/tags","blobs_url":"https://api.github.com/repos/bobmayuze/gold-miner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bobmayuze/gold-miner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bobmayuze/gold-miner/git/refs{/sha}","trees_url":"https://api.github.com/repos/bobmayuze/gold-miner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bobmayuze/gold-miner/statuses/{sha}","languages_url":"https://api.github.com/repos/bobmayuze/gold-miner/languages","stargazers_url":"https://api.github.com/repos/bobmayuze/gold-miner/stargazers","contributors_url":"https://api.github.com/repos/bobmayuze/gold-miner/contributors","subscribers_url":"https://api.github.com/repos/bobmayuze/gold-miner/subscribers","subscription_url":"https://api.github.com/repos/bobmayuze/gold-miner/subscription","commits_url":"https://api.github.com/repos/bobmayuze/gold-miner/commits{/sha}","git_commits_url":"https://api.github.com/repos/bobmayuze/gold-miner/git/commits{/sha}","comments_url":"https://api.github.com/repos/bobmayuze/gold-miner/comments{/number}","issue_comment_url":"https://api.github.com/repos/bobmayuze/gold-miner/issues/comments{/number}","contents_url":"https://api.github.com/repos/bobmayuze/gold-miner/contents/{+path}","compare_url":"https://api.github.com/repos/bobmayuze/gold-miner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bobmayuze/gold-miner/merges","archive_url":"https://api.github.com/repos/bobmayuze/gold-miner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bobmayuze/gold-miner/downloads","issues_url":"https://api.github.com/repos/bobmayuze/gold-miner/issues{/number}","pulls_url":"https://api.github.com/repos/bobmayuze/gold-miner/pulls{/number}","milestones_url":"https://api.github.com/repos/bobmayuze/gold-miner/milestones{/number}","notifications_url":"https://api.github.com/repos/bobmayuze/gold-miner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bobmayuze/gold-miner/labels{/name}","releases_url":"https://api.github.com/repos/bobmayuze/gold-miner/releases{/id}","deployments_url":"https://api.github.com/repos/bobmayuze/gold-miner/deployments","created_at":"2015-12-25T15:39:00Z","updated_at":"2016-02-19T12:15:34Z","pushed_at":"2016-02-19T13:47:27Z","git_url":"git://github.com/bobmayuze/gold-miner.git","ssh_url":"git@github.com:bobmayuze/gold-miner.git","clone_url":"https://github.com/bobmayuze/gold-miner.git","svn_url":"https://github.com/bobmayuze/gold-miner","homepage":"http://gold.xitu.io","size":8419,"stargazers_count":0,"watchers_count":0,"language":null,"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":"xitu:master","ref":"master","sha":"c9869b27911fa20c613dad1f6f6c32aaaae1c312","user":{"login":"xitu","id":10482599,"avatar_url":"https://avatars.githubusercontent.com/u/10482599?v=3","gravatar_id":"","url":"https://api.github.com/users/xitu","html_url":"https://github.com/xitu","followers_url":"https://api.github.com/users/xitu/followers","following_url":"https://api.github.com/users/xitu/following{/other_user}","gists_url":"https://api.github.com/users/xitu/gists{/gist_id}","starred_url":"https://api.github.com/users/xitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitu/subscriptions","organizations_url":"https://api.github.com/users/xitu/orgs","repos_url":"https://api.github.com/users/xitu/repos","events_url":"https://api.github.com/users/xitu/events{/privacy}","received_events_url":"https://api.github.com/users/xitu/received_events","type":"Organization","site_admin":false},"repo":{"id":45512989,"name":"gold-miner","full_name":"xitu/gold-miner","owner":{"login":"xitu","id":10482599,"avatar_url":"https://avatars.githubusercontent.com/u/10482599?v=3","gravatar_id":"","url":"https://api.github.com/users/xitu","html_url":"https://github.com/xitu","followers_url":"https://api.github.com/users/xitu/followers","following_url":"https://api.github.com/users/xitu/following{/other_user}","gists_url":"https://api.github.com/users/xitu/gists{/gist_id}","starred_url":"https://api.github.com/users/xitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitu/subscriptions","organizations_url":"https://api.github.com/users/xitu/orgs","repos_url":"https://api.github.com/users/xitu/repos","events_url":"https://api.github.com/users/xitu/events{/privacy}","received_events_url":"https://api.github.com/users/xitu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xitu/gold-miner","description":"掘金翻译计划，翻译掘金上优质的英文文章","fork":false,"url":"https://api.github.com/repos/xitu/gold-miner","forks_url":"https://api.github.com/repos/xitu/gold-miner/forks","keys_url":"https://api.github.com/repos/xitu/gold-miner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xitu/gold-miner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xitu/gold-miner/teams","hooks_url":"https://api.github.com/repos/xitu/gold-miner/hooks","issue_events_url":"https://api.github.com/repos/xitu/gold-miner/issues/events{/number}","events_url":"https://api.github.com/repos/xitu/gold-miner/events","assignees_url":"https://api.github.com/repos/xitu/gold-miner/assignees{/user}","branches_url":"https://api.github.com/repos/xitu/gold-miner/branches{/branch}","tags_url":"https://api.github.com/repos/xitu/gold-miner/tags","blobs_url":"https://api.github.com/repos/xitu/gold-miner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xitu/gold-miner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xitu/gold-miner/git/refs{/sha}","trees_url":"https://api.github.com/repos/xitu/gold-miner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xitu/gold-miner/statuses/{sha}","languages_url":"https://api.github.com/repos/xitu/gold-miner/languages","stargazers_url":"https://api.github.com/repos/xitu/gold-miner/stargazers","contributors_url":"https://api.github.com/repos/xitu/gold-miner/contributors","subscribers_url":"https://api.github.com/repos/xitu/gold-miner/subscribers","subscription_url":"https://api.github.com/repos/xitu/gold-miner/subscription","commits_url":"https://api.github.com/repos/xitu/gold-miner/commits{/sha}","git_commits_url":"https://api.github.com/repos/xitu/gold-miner/git/commits{/sha}","comments_url":"https://api.github.com/repos/xitu/gold-miner/comments{/number}","issue_comment_url":"https://api.github.com/repos/xitu/gold-miner/issues/comments{/number}","contents_url":"https://api.github.com/repos/xitu/gold-miner/contents/{+path}","compare_url":"https://api.github.com/repos/xitu/gold-miner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xitu/gold-miner/merges","archive_url":"https://api.github.com/repos/xitu/gold-miner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xitu/gold-miner/downloads","issues_url":"https://api.github.com/repos/xitu/gold-miner/issues{/number}","pulls_url":"https://api.github.com/repos/xitu/gold-miner/pulls{/number}","milestones_url":"https://api.github.com/repos/xitu/gold-miner/milestones{/number}","notifications_url":"https://api.github.com/repos/xitu/gold-miner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xitu/gold-miner/labels{/name}","releases_url":"https://api.github.com/repos/xitu/gold-miner/releases{/id}","deployments_url":"https://api.github.com/repos/xitu/gold-miner/deployments","created_at":"2015-11-04T03:29:13Z","updated_at":"2016-02-23T05:16:38Z","pushed_at":"2016-02-23T02:24:34Z","git_url":"git://github.com/xitu/gold-miner.git","ssh_url":"git@github.com:xitu/gold-miner.git","clone_url":"https://github.com/xitu/gold-miner.git","svn_url":"https://github.com/xitu/gold-miner","homepage":"http://gold.xitu.io","size":8467,"stargazers_count":286,"watchers_count":286,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":66,"mirror_url":null,"open_issues_count":20,"forks":66,"open_issues":20,"watchers":286,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/115"},"html":{"href":"https://github.com/xitu/gold-miner/pull/115"},"issue":{"href":"https://api.github.com/repos/xitu/gold-miner/issues/115"},"comments":{"href":"https://api.github.com/repos/xitu/gold-miner/issues/115/comments"},"review_comments":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/115/comments"},"review_comment":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/115/commits"},"statuses":{"href":"https://api.github.com/repos/xitu/gold-miner/statuses/571c458373ca1be47c115d748077b0658f9ef9fa"}}}}