-
Notifications
You must be signed in to change notification settings - Fork 0
/
index2.html
211 lines (193 loc) · 12.3 KB
/
index2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>I'm aaapei</title>
<meta name="author" content="aaapei">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Open Graph tags -->
<meta property="og:type" content="website"/>
<meta property="og:title" content="I'm aaapei"/>
<meta property="og:url" content="http://blog.aaapei.com"/>
<meta property="og:description" content="I'm aaapei"/>
<link rel="canonical" href="">
<link href="http://blog.aaapei.com/favicon.png" rel="shortcut icon">
<link href="http://blog.aaapei.com/theme/css/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="http://blog.aaapei.com/theme/css/pygments.css" media="screen, projection" rel="stylesheet" type="text/css">
<!--[if lt IE 9]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<!--
<link href="//fonts.googleapis.com/css?family=Open+Sans:400italic,400,700" rel='stylesheet' type='text/css'>
<link href="//fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel='stylesheet' type='text/css'>
<link href="//fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel='stylesheet' type='text/css'>
-->
<script src="//lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script>
<!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
</head>
<body>
<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F42905fb57b3457075b7322a0893c5395' type='text/javascript'%3E%3C/script%3E"));
</script>
<div class="container">
<div class="left-col">
<div class="intrude-less">
<header id="header" class="inner">
<div class="profilepic">
<img src="http://nos.netease.com/knowledge/85c5dfab-ec44-4818-a018-1fc31e8baa4f" alt="Profile Picture" style="width: 160px;" />
</div>
<hgroup>
<br/>
<h1><a href="http://blog.aaapei.com/">I'm aaapei</a></h1>
<h3>少年去游荡</h3>
</hgroup>
<nav id="main-nav">
<ul class="main-navigation">
<li><a href="http://blog.aaapei.com/.">首页</a></li>
<li><a href="http://blog.aaapei.com/categories.html">分类</a></li>
<li><a href="http://blog.aaapei.com/pages/sui-sui-nian">碎碎念</a></li>
</ul></nav>
<nav id="sub-nav">
<div class="social">
<a class="email" href="mailto:[email protected]" title="Email">Email</a>
<a class="weibo" href="http://weibo.com/a2pei" title="Weibo">Weibo</a>
<a class="rss" href="http://blog.aaapei.com/rss.xml" title="RSS">ATOM</a>
</div>
<section id="about-me">
<h2>关于我</h2>
<p>生活@hangzhou. 工作@netease.<br/> 移动端码农. 正在减肥的胖子. 食肉. <br/>想养喵但老婆不让</p>
</section>
</nav> </header>
</div>
</div>
<div class="mid-col">
<div class="mid-col-container">
<div id="content" class="inner">
<article class="post" itemprop="blogPost" itemscope itemtype="http://schema.org/BlogPosting">
<div class="meta">
<div class="date">
<time datetime="2015-02-19T00:00:00.000000+0800" itemprop="datePublished">2015-02-19</time>
</div>
<div class="tags">
<a href="http://blog.aaapei.com/tags/bitmapxing-neng-you-hua">bitmap,性能优化</a> </div>
</div> <h1 class="title" itemprop="name"><a href="http://blog.aaapei.com/article/2015/02/bookingcom-androidke-hu-duan-de-bitmapfu-yong" itemprop="url">booking.com android客户端的bitmap复用</a></h1>
<div class="entry-content" itemprop="description"><h3>前言</h3>
<p>被鞭炮吵得睡不着觉,rss中找一篇简单的文档翻译下,原文链接:http://blog.booking.com/android-reuse-bitmaps.html,大部分团队应该都做过这个bitmap优化,不过估计设置过BitmapFactory.Options.inTempStorage参数的应该不多 :)</p>
<p>booking.com android客户端在新版本的增加了一个新功能:酒店的图片集合</p>
<p><img alt="此处输入图片的描述" src="http://blog.booking.com/static/android-reuse-bitmaps/hotel_photo_header.png"></p>
<p>不幸的是,增加了这个新功能后,发现这个应用的内存消耗增长了20%。图片集的界面的滑动有明显的卡顿,经定位,我们发现viewpager加载图片时的gc问题造成了以上的问题。由于应用的图片资源多;控件布局层次复杂;数据量较大,造成内存的申请很容易触发GC。</p>
<p>当申请bitmap内存时,logcat输出信息如下:</p>
<div class="highlight"><pre><span></span>GC_FOR_ALLOC freed 3255K, 20% free 21813K/26980K, paused 62ms, total 62ms
GC_FOR_ALLOC freed 710K, 20% free 30242K/37740K, paused 72ms …</pre></div>
<br/ >
<a href="http://blog.aaapei.com/article/2015/02/bookingcom-androidke-hu-duan-de-bitmapfu-yong">查看全文</a>
</div>
<div class="meta">
<span class="author">Posted by <a href="http://blog.aaapei.com/author/zhengwen.html">zhengwen</a></span>
</div>
</article>
<hr/>
<article class="post" itemprop="blogPost" itemscope itemtype="http://schema.org/BlogPosting">
<div class="meta">
<div class="date">
<time datetime="2015-02-01T00:00:00.000000+0800" itemprop="datePublished">2015-02-01</time>
</div>
<div class="tags">
<a href="http://blog.aaapei.com/tags/listviewxing-neng-you-hua">listview,性能优化</a> </div>
</div> <h1 class="title" itemprop="name"><a href="http://blog.aaapei.com/article/2015/02/facebookxin-wen-ye-listviewyou-hua" itemprop="url">facebook新闻页ListView优化</a></h1>
<div class="entry-content" itemprop="description"><h3>引言</h3>
<p>原文链接:<a href="https://code.facebook.com/posts/879498888759525/fast-rendering-news-feed-on-android/">https://code.facebook.com/posts/879498888759525/fast-rendering-news-feed-on-android/</a>
透漏的信息量不大,且大多数项目并不会遇到facebook这种ListView的场景,不过可以拓展下思路:逻辑单元不一定是视图单元;移动端不要死搬MVC的架构,在市场上仍是中低端机型为主时,还是应该多考虑性能;附上rebbit的关于本文的<a href="http://www.reddit.com/r/androiddev/comments/2tzrqe/fast_rendering_news_feed_on_android/">讨论</a>,有些干货 :)</p>
<h3>基础知识</h3>
<p>android系统每隔16.7ms发出一个渲染信号,通知ui线程进行界面的渲染。为了达到流畅的体验,应用程序需要在这个时间内完成应用逻辑,使系统达到60fps。当一个Listview被添加到布局时,其关联的adapter的getView方法将会被回调。在16.7毫秒这样一个时间单元内,可见listitem单元的getView方法将被按照顺序执行。在大多数情况下,由于其他绘图行为的存在,例如measure和draw,getVIew实际分配到执行时间远低于16ms。一旦listview包含复杂控件时,在16毫秒内不能完成渲染,用户只能看到上一祯的结果,这时就发生了掉帧。</p>
<h3>Facebook新闻页介绍</h3>
<p>Facebook的新闻页是一个复杂的listview控件,如何使它获得流畅的滚动体验一直困扰我们。
首先,新闻页的每一条新闻的可见区域非常大,包含一系列的文本以及照片;其次,新闻的展现类型也很多样,除了文本以及照片,新闻的附件还可包含链接、音频 …</p>
<br/ >
<a href="http://blog.aaapei.com/article/2015/02/facebookxin-wen-ye-listviewyou-hua">查看全文</a>
</div>
<div class="meta">
<span class="author">Posted by <a href="http://blog.aaapei.com/author/zhengwen.html">zhengwen</a></span>
</div>
</article>
<hr/>
<article class="post" itemprop="blogPost" itemscope itemtype="http://schema.org/BlogPosting">
<div class="meta">
<div class="date">
<time datetime="2014-12-21T00:00:00.000000+0800" itemprop="datePublished">2014-12-21</time>
</div>
<div class="tags">
<a href="http://blog.aaapei.com/tags/android">android</a> , <a href="http://blog.aaapei.com/tags/yi-bu">异步</a> </div>
</div> <h1 class="title" itemprop="name"><a href="http://blog.aaapei.com/article/2014/12/androidyi-bu-bian-cheng" itemprop="url">android异步编程</a></h1>
<div class="entry-content" itemprop="description"><p>在android开发中,有两条很重要的<a href="http://developer.android.com/guide/components/processes-and-threads.html">编程准则</a></p>
<ul>
<li>不要堵塞ui线程</li>
<li>不要在非ui线程操作ui控件</li>
</ul>
<p>开发者必须这两个遵守单线程模型的准则,将耗时的逻辑转移到非ui线程进行,得出计算结果后,通知ui线程进行数据的展现。本文介绍一下android的异步编程。</p>
<h3>android线程模型</h3>
<p>同hotspot vm一样,在daivlk vm中,采取的是1:1线程模型,每一个android thread对应一个Native Linux thread;linux内核通过cfs(completely fair scheduler)来进行线程调度,在cfs中着影响一个线程时间分配的因素有两个:</p>
<ul>
<li>thread priority</li>
<li>thread group</li>
</ul>
<h4>thread group</h4>
<p>线程的thread group是动态改变的,在android framework层面,android的应用有5个等级,分别是</p>
<ul>
<li>foreground process</li>
<li>visible process</li>
<li>service process</li>
<li>backgroud process</li>
<li>empty process </li>
</ul>
<p>它们的thread …</p>
<br/ >
<a href="http://blog.aaapei.com/article/2014/12/androidyi-bu-bian-cheng">查看全文</a>
</div>
<div class="meta">
<span class="author">Posted by <a href="http://blog.aaapei.com/author/zhengwen.html">zhengwen</a></span>
</div>
</article>
<hr/>
<article class="post" itemprop="blogPost" itemscope itemtype="http://schema.org/BlogPosting">
<div class="meta">
<div class="date">
<time datetime="2014-11-09T00:00:00.000000+0800" itemprop="datePublished">2014-11-09</time>
</div>
<div class="tags">
<a href="http://blog.aaapei.com/tags/dalvik">dalvik</a> , <a href="http://blog.aaapei.com/tags/jni">jni</a> </div>
</div> <h1 class="title" itemprop="name"><a href="http://blog.aaapei.com/article/2014/11/dalvik-jnijie-xi" itemprop="url">dalvik jni解析</a></h1>
<div class="entry-content" itemprop="description"><p>android开发者在移植第三方native库时,经常会使用到jni. <br>
Java Native Interface(java本地接口),用于java与c/c++代码进行交互.需要了解的是,jni只是jvm的一个规范,各家虚拟机有各自的实现,本文分享一下dalvik中jobject reference的实现.</p>
<h3>jobject reference type</h3>
<p>jni规范中,对jobject定义了两种reference类型:</p>
<ul>
<li>全局引用(global reference)</li>
<li>局部引用(local reference)</li>
</ul>
<p>在JNI Specification中的说明是:</p>
<blockquote>
<p>Local references are valid for the duration of a native method call, and are automatically freed after the native method returns. Global references …</p></blockquote>
<br/ >
<a href="http://blog.aaapei.com/article/2014/11/dalvik-jnijie-xi">查看全文</a>
</div>
<div class="meta">
<span class="author">Posted by <a href="http://blog.aaapei.com/author/zhengwen.html">zhengwen</a></span>
</div>
</article>
<hr/>
<nav id="pagenavi">
<a href="http://blog.aaapei.com/index.html" class="prev">Prev</a>
<a href="http://blog.aaapei.com" class="center">文章列表</a>
<a href="http://blog.aaapei.com/index3.html" class="next">前一页</a>
</nav>
</div>
</div>
<footer id="footer" class="inner">
<p>Copyright © 2013 - aaapei - <span class="credit">Powered by <a href="http://getpelican.com">Pelican</a></span></p> </footer>
</div>
</div>
</body>
</html>