怎样优化app,看facebook怎样做

xfgnongmin xfgnongmin     2022-12-03     195

关键词:

周四,Facebook Engineering blog 发表了一篇名为《Improving Facebook on Android》博文。博文从四个方面(Performance,Data Efficiency,

Networking,Application Size)讲述了Facebook是怎样优化app保证其在不同国家不同类型Android设备上都能表现出良好性能的。

因为原文内容比較

easy理解,这里就直接给出原文。以使上边链接打不开的同学也能看到。《菜鸟成长史:http://blog.csdn.net/zjbpku

In an effort to connect the next five billion, Facebook began to shift to a mobile-first company about
two years ago. We trained hundreds of employees on mobile development, restructured internal
teams to build for all platforms, and moved to a fast-paced release cycle.

However, our mission extends far beyond building and delivering the best experience on high-end
smartphones and LTE networks. We want Facebook to work for everyone – no matter the region,
network condition, or mobile device.

To help accomplish this goal, a team of product managers and engineers traveled to Africa to
examine mobile performance in developing countries. We purchased several different Android
handsets to test the latest version of the Facebook app – and the testing process proved to be
difficult. The combination of an intermittent, low-bandwidth network connection and a lack of
memory space on the devices resulted in slow load times and constant crashes. We even burned
through our monthly data plans in 40 minutes.We returned to our offices in Seattle, London, and?
Menlo Park determined to enhance theFacebook experience on Android – and soon made major improvements
in performance, data efficiency, networking, and application size.

Performance
In terms of performance, we wanted to improve slow start times on old devices. In the beginning,
we focused on instrumenting the startup path and understanding the bottlenecks. There was no
silver bullet in this process – we needed to carefully identify and remove each potential bottleneck.
For example, we found that start times were slower on single-core devices because too many
features concurrently initialized themselves on application startup. We made sure to defer these
initializations until after startup and, in some cases, until the features are used.
We also wanted the stories in News Feed to load faster. In order to rapidly display cached content
on poor networks, we now fetch stories earlier in the process to allow more time to set up
connections and download News Feed. The cold start path has been automated to ensure that we
prevent further regressions in these areas.These changes reduced start times by more than 50 percent
in the six months following the trip to Africa.

Data efficiency
Next, we realized that data is extremely expensive in emerging markets, and purchasing more
data is often a laborious process. Thus, there needed to be a concerted effort to reduce data
consumption within the Facebook app. Interacting with photos is an important part of the
Facebook experience, but it takes a sizable amount of data to download them. If we could
optimize the download size, we could improve data savings and perceived app performance.
First, we investigated the use of alternative compression formats for image transmission. We built
tools to evaluate the impact of several different compression formats on data sizes and eventually
settled on WebP. It offered both great compression performance and efficient support from
Android. The use of WebP for transmitting Facebook images resulted in data savings of 25 to 35
percent compared with JPG, and 80 percent compared with PNG. This all happened without perceived?
impact on quality.The next step was to work on loading images at a resolution that devices had the?
ability to handle.In the past, we loaded images at maximum resolution to allow for the zoom-in feature.
However,on these kinds of devices this feature was used infrequently. We changed the process of loading
images to only request resolutions equivalent to the size of the viewport in which the images will
appear. Instead of loading a full image, the device only loads the image it needs to show (such as
a thumbnail, preview, or full image at lower resolution). Of course, if someone wants to zoom-in
on an image, we then download a higher resolution image.Finally, we looked over the process used to?
cache and reuse images. We tested a number of potential caching strategies, as well as sizes for our?
caches, and fine-tuned both to minimize the evictions for images that could be accessed again.
As was the case with performance, it was important to avoid regressing our data efficiency in the
future. We built automated tests and an elaborate system that can attribute data usage to
individual features. This allows Facebook features to understand their data usage in production
and make adjustments if it increases unexpectedly.The work on data efficiency resulted in a 50 percent
reduction in data use compared with earlier last year.

Networking
We also invested heavily in improving the efficiency and reliability of our networking stack. It was
important to implement more modern networking concepts in emerging markets because our
stacks struggled to perform in regions with intermittent networks.
Facebook was an early adopter of OkHttp, a networking stack open-sourced by Square, and it’s
now the stack used by the Android app. OkHttp allows us to support fast retries for intermittent
network situations, take advantage of the SPDY protocol for faster concurrent network
transmissions, and enable powerful instrumentation across the networking stack.
After switching to OkHttp, it became a goal to decrease the number of reports regarding failed
image loads in News Feed. We fine-tuned our image pre-fetching algorithms and altered the
process through which we queue images for download. The process now ensures that the
images expected to be downloaded next are prioritized in the queue and that no images are stuck
in the queue for too long.In combination with better data usage for images, reports of slow or failed?
image loads dropped by almost 90 percent over the past year.

Application size
The most popular mobile devices in Africa have little disk space available, which is a significant
barrier to installing app upgrades. This means that people in developing countries often use older
versions of the app that don’t have up-to-date features or take advantage of the improvements
described in this blog post.Our colleagues in the Facebook London office focused on improving app?
size efficiency. They approached this problem by utilizing Google Play’s ability to upload multiple
APKs for different Android OSes and screen resolutions. This allows us to exclude excess code for features or
resources not supported on certain mobile devices.As with the other areas, instrumentation and testability
were important to making sure we could bring the app size down. We now have tools that calculate how?
each feature contributes to app size and analyze device size regressions.In the end, the app size has?
been reduced by 65 percent compared with the beginning of the year.

What comes next?
Our trip to Africa really highlighted the importance of our work on mobile performance, data
efficiency, networking reliability, and application size for emerging markets. We’ve made a
concerted effort to improve in all these areas and achieved a significant amount of success in the
past year.
The lessons learned have already impacted the development of new features. We test all major
features and changes in poor networking scenarios. We have automated verification for various
performance and efficiency characteristics, which allows the features team to receive immediate
feedback on the impact of their code. We also expanded our playbook to other apps, such as
Messenger and Instagram.We will continue to innovate to make the Facebook experience better in emerging?
markets, and share tools and information that can help developers build apps that work well on different
handsets, network environments, and operating systems.


注:以上英文内容来自:Facebook Code?https://code.facebook.com/posts/485459238254631/improving-facebook-on-android/

seo优化:怎样才能把网站关键词排名做上来

如何把网站关键词seo排名做上去呢?表示很多人不断探求SEO排名方法、百度排名规则。在互联网上寻找各种各样秘籍宝典,当你耗费大量的时间做这些无用工时,我需要提醒你,你忽略了做关键词seo排名成功的本质:执行力。关... 查看详情

app登录注册功能,怎样做到用户体验最佳?

用户登录系统,可以细分为三项功能模块,分别是:登录、注册和密码找回。本文作者将结合自身经历,谈谈他在做这块的时候一些想法,主要是涉及业务流程。登录和注册功能,不论是PC端还是移动端,大多数产品都会涉及到... 查看详情

怎样优化im即时通讯移动端app的日志上报机制

当前的移动互联网时代,移动端应用的流量昂贵和敏感,为了统计APP内用户行为,或者需要收集某些产品数据,往往需要进行日志上报。日志上报往往又非常费流量,有没有一些好的节省流量的优化方法呢ÿ... 查看详情

android怎样做心电图

参考技术A在手机上做心电图,需要有硬件配置和专用软件。Android手机能不能做心电图,首先要看手机有没有外接的电极,如果没有电极,即使安装了软件也不能做心电图。 查看详情

怎样为企业网站制定合适的seo优化策略

...要找到一个折中的平衡点,从而更好的做网站推广。那么怎样为企业网站优化制定一个合适的推广策略及平衡点呢?网站优化一般还需要根据搜索引擎的变化而变化。毕竟现在搜索引擎算法更新比较快,尤其是对于一些漏洞,完... 查看详情

我怎样才能优化这个脚本,这样它就不需要一周的时间来完成它正在做的任务? (也使用了 BASH PARALLEL。)

】我怎样才能优化这个脚本,这样它就不需要一周的时间来完成它正在做的任务?(也使用了BASHPARALLEL。)【英文标题】:HowcanIoptimizethisscriptsoitdoesnottakeaweektofinishthetaskitisdoing?(UsedBASHPARALLELtoo.)【发布时间】:2018-12-0408:48:12【问... 查看详情

快要做外公的盖茨是怎样看chatgpt和web3

1月12日下午,微软联合创始人比尔·盖茨(BillGates)在Reddit上的一年一度AskMeAnything活动上对时下热门科技概念发表了看法。这是比尔·盖茨第11次参加Reddit在线的问答活动,他回答了网友关于世界气候、AI、医疗等... 查看详情

怎样优化数据库查询

宏观:1.缓存。在持久层或持久层之上做缓存。 从数据库中查询出来的数据先放入缓存中,下次查询时,先訪问缓存。假设未命中则查询数据库。2.表分区和拆分.不管是业务逻辑上的拆分还是无业务含义的分区。3.提高磁盘... 查看详情

keil怎样看编译产生的汇编代码

使用c51编程,怎样查看编译后产生的汇编代码呢。麻烦详细说明下在成功编译的前提下,按Ctrl+F5,或依次点击菜单栏的“Debug”>>“Start/Stop Debug Session”,切换到调试界面。调试界面下,依次点击菜单栏的“View”>&... 查看详情

做自由职业者是怎样的体验

1.自由首先要说自由职业者的自由。女儿看牙,时间约到周一下午,没关系,直接去了,不用请假。复诊,约到周五下午,没关系,直接去了,不用请假。朋友约见面聊天,周三中午,没关系,直接去了,不用请假,因为不用考... 查看详情

转51cto网+怎样做一款让用户来电的产品

【51CTO网+】怎样做一款让用户来电的产品 据相关调查显示,目前全球移动用户平均每人安装应用约95个,每天使用的应用约35个。可见面对众多的移动应用,用户拥有非常大的选择空间。如果由于交互设计欠佳影响用户体验... 查看详情

我怎样才能像这样的 Facebook 帖子一样显示专辑图片?

】我怎样才能像这样的Facebook帖子一样显示专辑图片?【英文标题】:HowcanishowAlbumimagesLikeFacebookpostlikethis?【发布时间】:2020-06-2716:49:14【问题描述】:根据用户上传的内容,我从API链接获取单个图像或多个图像链接。所以我想... 查看详情

竞价账户托管优化:要做好竞价怎样少走弯路

竞价账户托管优化:要做好竞价怎样少走弯路关键词:竞价 关键词选取做好竞价竞价托管竞价是一项专业性很强的工作,不是单单的拼价格,那样只会杀敌一千自损八百,造成不必要的企业资源浪费。那么怎么做才能更好的... 查看详情

怎样统计app渠道推广数据

“我在广告上的投资有一半是无用的,但是问题是我不知道是哪一半。”这是百货商店之父约翰.沃纳梅克一百多年前提出的广告界“哥德巴赫猜想”。放在今天也是同样的道理,你花了一大笔预算去给自家开发的App... 查看详情

Facebook iOS SDK - 我怎样才能使页面赞按钮有效?

】FacebookiOSSDK-我怎样才能使页面赞按钮有效?【英文标题】:FacebookiOSSDK-HowcanImakeaPageLikeButtonworks?【发布时间】:2015-06-1106:17:49【问题描述】:我正在尝试使用FBSDKLikeControl/FBSDKLikeButton让用户喜欢我的粉丝页。我尝试了他们的示... 查看详情

怎样学习lotusdomino代理

怎样学习Lotusdomino代理代理分为java和lotusscript,java需要学习一下java基础类,然后看一下lotusdomino的类,熟悉常用的即可。lotusscript的格式和vb差不多,懂vb的上手很快!参考技术A1、有基本的编程思想2、就是拿来主义,先从帮助里... 查看详情

独立开发一个app是一种怎样的体验?

...原文是我在知乎上写的一篇回答:独立开发一个App是一种怎样的体验?) UWP业余开发者表示,非常愿意做一股清流。在喧闹无比的iOS和Android平台,为了给应用造势,太多人费尽心思,勾心斗角,而这边厢,Win10应用商店冷冷... 查看详情

看《罗辑思维》之“怎样成为一个高手”有感

看了《罗辑思维》之“怎样成为一个高手”这期视频后,我有以下认知:一:刻意学习。二:逃离舒适区,进入学习区。三:越高级越有能耐的人,越忙越没空。也就是说想要成为一个领域的高手,必须要有吃苦的精神,脱离身... 查看详情