-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
427 lines (419 loc) · 25 KB
/
index.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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
<!doctype html>
<!--
Minimal Mistakes Jekyll Theme 4.19.2 by Michael Rose
Copyright 2013-2019 Michael Rose - mademistakes.com | @mmistakes
Free for personal and commercial use under the MIT license
https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE
-->
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<!-- begin _includes/seo.html -->
<title>Some ideas about multicore on Android - iBug One</title>
<meta name="description" content="Why do Android phones have more cores than computers? ">
<meta name="author" content="iBug">
<meta property="og:type" content="article">
<meta property="og:locale" content="en_US">
<meta property="og:site_name" content="iBug One">
<meta property="og:title" content="Some ideas about multicore on Android">
<meta property="og:url" content="https://ibugone.com/blog/2017/06/android-phone-cores/">
<meta property="og:description" content="Why do Android phones have more cores than computers? ">
<meta property="og:image" content="https://ibugone.com/image/og.jpg">
<meta property="article:published_time" content="2017-06-11T10:51:16+00:00">
<meta property="article:modified_time" content="2019-06-17T16:46:42+00:00">
<link rel="canonical" href="https://ibugone.com/blog/2017/06/android-phone-cores/">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Person",
"name": "iBug",
"url": "https://ibugone.com/"
}
</script>
<meta name="google-site-verification" content="5_jn7a-vZslUtLJO-BkY-cPDGgah5JP49RGgeOBmYSk" />
<!-- end _includes/seo.html -->
<link href="/feed.xml" type="application/atom+xml" rel="alternate" title="iBug One Feed">
<!-- https://t.co/dKP3o1e -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/g, '') + ' js ';
</script>
<!-- For all browsers -->
<link rel="stylesheet" href="/assets/css/main.css">
<!--[if IE]>
<style>
/* old IE unsupported flexbox fixes */
.greedy-nav .site-title {
padding-right: 3em;
}
.greedy-nav button {
position: absolute;
top: 0;
right: 0;
height: 100%;
}
</style>
<![endif]-->
<link rel="shortcut icon" type="image/png" href="/assets/favicon.png">
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
<meta name="theme-color" content="#EDEDED">
<script type="text/javascript">
const funcOnPageLoad = () => document.querySelector("body").classList.add("loaded");
if (document.readyState !== "loading")
setTimeout(funcOnPageLoad, 500);
else
document.addEventListener('DOMContentLoaded', funcOnPageLoad);
</script>
<script type="text/javascript" async src="/assets/js/love.js"></script>
<!--
Minimal Mistakes layout: single
Page Path: _posts/2017-06-11-android-phone-cores.md
Page Type:
-->
</head>
<body class="layout--single">
<nav class="skip-links">
<h2 class="screen-reader-text">Skip links</h2>
<ul>
<li><a href="#site-nav" class="screen-reader-shortcut">Skip to primary navigation</a></li>
<li><a href="#main" class="screen-reader-shortcut">Skip to content</a></li>
<li><a href="#footer" class="screen-reader-shortcut">Skip to footer</a></li>
</ul>
</nav>
<!--[if lt IE 9]>
<div class="notice--danger align-center" style="margin: 0;">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience.</div>
<![endif]-->
<div class="masthead">
<div class="masthead__inner-wrap">
<div class="masthead__menu">
<nav id="site-nav" class="greedy-nav">
<a class="site-logo" href="/"><img src="/assets/favicon.png" alt=""></a>
<a class="site-title" href="/">
iBug
</a>
<ul class="visible-links">
<li class="masthead__menu-item">
<a href="/about/">About</a>
</li>
<li class="masthead__menu-item">
<a href="/blog/">Blog</a>
</li>
<li class="masthead__menu-item">
<a href="/projects/">Projects</a>
</li>
<li class="masthead__menu-item">
<a href="https://github.com/iBug">GitHub <i class="fa fas fa-xs fa-external-link-alt"></i></a>
</li>
<li class="masthead__menu-item">
<a href="/cn/">中文内容</a>
</li>
</ul>
<button class="search__toggle" type="button">
<span class="visually-hidden">Toggle search</span>
<svg class="icon" width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.99 16">
<path d="M15.5,13.12L13.19,10.8a1.69,1.69,0,0,0-1.28-.55l-0.06-.06A6.5,6.5,0,0,0,5.77,0,6.5,6.5,0,0,0,2.46,11.59a6.47,6.47,0,0,0,7.74.26l0.05,0.05a1.65,1.65,0,0,0,.5,1.24l2.38,2.38A1.68,1.68,0,0,0,15.5,13.12ZM6.4,2A4.41,4.41,0,1,1,2,6.4,4.43,4.43,0,0,1,6.4,2Z" transform="translate(-.01)"></path>
</svg>
</button>
<button class="greedy-nav__toggle hidden" type="button">
<span class="visually-hidden">Toggle menu</span>
<div class="navicon"></div>
</button>
<ul class="hidden-links hidden"></ul>
</nav>
</div>
</div>
</div>
<div class="initial-content">
<div class="page__hero--overlay"
style=" background-image: url('/image/header/mountain-1.jpg');"
>
<div class="wrapper">
<h1 id="page-title" class="page__title" itemprop="headline">
Some ideas about multicore on Android
</h1>
<p class="page__lead">An Android Enthusiasts Q&A
</p>
<p class="page__meta"><i class="far fa-calendar-alt" aria-hidden="true"></i> June 11, 2017</p>
</div>
</div>
<div id="main" role="main">
<div class="sidebar sticky">
<div itemscope itemtype="https://schema.org/Person">
<div class="author__avatar">
<img src="/image/avatar.png" alt="iBug" itemprop="image">
</div>
<div class="author__content">
<h3 class="author__name" itemprop="name">iBug</h3>
<div class="author__bio" itemprop="description">
<p>Developer, System Administrator, Geek</p>
</div>
</div>
<div class="author__urls-wrapper">
<button class="btn btn--inverse">Follow</button>
<ul class="author__urls social-icons">
<li><a href="mailto:%69@ibugone.com" rel="nofollow noopener noreferrer"><i class="fas fa-fw fa-envelope-square" aria-hidden="true"></i><span class="label">Email</span></a></li>
<li><a href="https://stackoverflow.com/users/5958455/ibug" rel="nofollow noopener noreferrer"><i class="fab fa-fw fa-stack-overflow" aria-hidden="true"></i><span class="label">Stack Overflow</span></a></li>
<li><a href="https://github.com/iBug" rel="nofollow noopener noreferrer"><i class="fab fa-fw fa-github" aria-hidden="true"></i><span class="label">GitHub</span></a></li>
<li><a href="https://steamcommunity.com/id/ibugone" rel="nofollow noopener noreferrer"><i class="fab fa-fw fa-steam" aria-hidden="true"></i><span class="label">Steam</span></a></li>
<!--
<li>
<a href="http://link-to-whatever-social-network.com/user/" itemprop="sameAs" rel="nofollow noopener noreferrer">
<i class="fas fa-fw" aria-hidden="true"></i> Custom Social Profile Link
</a>
</li>
-->
</ul>
</div>
</div>
<nav class="nav__list">
<input id="ac-toc" name="accordion-toc" type="checkbox" />
<label for="ac-toc">Toggle Menu</label>
<ul class="nav__items">
<li>
<span class="nav__sub-title">iBug on the Web</span>
<ul>
<li><a href="/"><i class="fas fa-fw fa-home"></i> Home</a></li>
<li><a href="/about/"><i class="fas fa-fw fa-smile"></i> About iBug</a></li>
<li><a href="/blog/"><i class="fas fa-fw fa-book"></i> Blog</a></li>
<li><a href="/skills/"><i class="fas fa-fw fa-wrench"></i> Skills</a></li>
<li><a href="/projects/"><i class="fas fa-fw fa-puzzle-piece"></i> Projects</a></li>
<li><a href="/entertainment/"><i class="fas fa-fw fa-gamepad"></i> Entertainment</a></li>
<li><a href="/friends/"><i class="fas fa-fw fa-user-friends"></i> Friends</a></li>
<li><a href="/cn/"><i class="fas fa-fw fa-yin-yang"></i> Chinese Content</a></li>
</ul>
</li>
</ul>
</nav>
</div>
<article class="page" itemscope itemtype="https://schema.org/CreativeWork">
<meta itemprop="headline" content="Some ideas about multicore on Android">
<meta itemprop="description" content="Laptops have usually at most four cores, and dualcores are probably more common. I have recently switched from quadcore to dualcore and I can confirm there is a limited number of use cases for quadcore, even with CPU intensive tasks.">
<meta itemprop="datePublished" content="2017-06-11T10:51:16+00:00">
<meta itemprop="dateModified" content="2019-06-17T16:46:42+00:00">
<div class="page__inner-wrap">
<section class="page__content" itemprop="text">
<p>Laptops have usually at most four cores, and dualcores are probably more common. I have recently switched from quadcore to dualcore and I can confirm there is a limited number of use cases for quadcore, even with CPU intensive tasks.</p>
<p>On the other hand, on mobile phones, quadcores, hexacores and octacores seem to be common. Why? What tasks can utilize them?</p>
<hr />
<p>First things first, <strong>the <a href="https://en.wikipedia.org/wiki/ARM_big.LITTLE">big.LITTLE</a> combination strategy</strong> (technically, <a href="https://en.m.wikipedia.org/wiki/Heterogeneous_computing"><strong>HMP</strong></a>, <strong>Heterogeneous Multi-Processing</strong> clusters) is the primary reason for so many (and sometimes overwhelmingly many) cores. A mobile device often runs into multiple scenarios, both heavy load and light load ones included.</p>
<p>An extreme consumer-class example is MediaTek’s Helio X20, which has 2 performance-oriented A72 cores, 4 balanced A53 cores, plus 4 energy-efficient A35 cores. That’s very flexible throughout different usage cases. However, I think <s>8 cores</s> 2 clusters is usually enough.</p>
<p>There’s also another desktop-like example, Qualcomm’s Snapdragon 800 series (S 800, S 801, and S 805). There are only 4 cores of the same microarchitecture in each SoC, with 2 clocked higher and 2 clocked lower. Qualcomm made these SoCs because they were very confident of their own microarchitecture (Krait 400 and Krait 450).</p>
<p>For games, even if they seemingly demand GPU performance rather than CPU, they still put a heavy load on the CPU. A GPU cannot work alone without something else supplying it with data to be processed, and that’s one of the major jobs that the CPU is doing while you’re gaming. In most gaming cases, the GPU only renders graphics, while all other jobs like loading data, resources and assets, and calculating in-game mechanics like the system, environment and physics are done by the CPU. You won’t observe a higher frame rate if you upgrade your GPU while sticking to a low-end CPU.</p>
<p>A secondary reason is <strong>how Android utilizes CPU resources</strong>. Android pretty much makes their own application environment. It uses nothing but codes (and APIs) from Java, but it has its own virtual machine named Dalvik, which was later replaced by ART (API Level 21). APKs have their executable codes in a “neutral” format, much like <code class="highlighter-rouge">.class</code> files in Java. Before they’re run, the codes get compiled once more into the machine’s native instructions<sup>[1]</sup>. The compilation process is multi-threaded and can utilize multi-cores for a performance boost.<br />
And when an app is running, there are several other processes and mechanics (like the Garbage Collector) that run alongside, or parallel to the app. More cores can let the supportive processes run more efficiently, as well as the main app.<br />
<sub>1. If you use a file type identifier, you’ll find that “optimized” dex files are in ELF format, while the “neutral” dex files are just in a format of their own.</sub></p>
<p>Another lesser reason is that <strong>ARM cores can’t work as fast as an Intel x86 chip</strong>. The Intel x86 microarchitecture can be dated back to 1976, when the <a href="https://en.wikipedia.org/wiki/Intel_8086">Intel 8086</a> chip started to be designed, which means that the x86 has developed over a long time. A single modern high-end ARM Cortex-A73 core is only as powerful as an Intel Clarkdale core, taking <a href="http://browser.primatelabs.com/geekbench3/search?q=i5-660">Core i5-660</a> as an example (GeekBench, single-core). This is because x86 is a <a href="https://en.wikipedia.org/wiki/Complex_instruction_set_computer">CISC</a> microarchitecture while ARM is a <a href="https://en.wikipedia.org/wiki/Reduced_instruction_set_computer">RISC</a> microarchitecture. You surely don’t want a phone that becomes laggy with only two or so active apps. More cores will help relieve the pressure. That’s why dual-core SoCs are relatively popular only on smart watches. Who needs performance on a smart watch?</p>
<p>Interestingly, <strong>more cores will result in less power than a single core at the same load</strong>. The relationship between CPU frequency and power consumption is more than linear, so twice the frequency will always result in demanding more than twice, or even 3x or 4x as much power, while delivering less than twice the performance (due to other resource limitations like cache). So 4 cores can easily beat a single core at the same load, providing better performance and simultaneously demanding less power.</p>
<p>Further Reading:</p>
<ul>
<li><a href="http://www.androidauthority.com/why-8-and-10-cpu-cores-in-smartphones-are-a-good-idea-607894/">Why 8 and 10 CPU cores in smartphones are a good idea – a lesson from the kitchen</a></li>
<li>
<p><a href="https://www.quora.com/Why-some-phones-have-two-quad-core-processors-and-some-have-similar-clocked-octa-core-Which-is-better-one-in-terms-of-performance?share=1">Why some phones have two quad core processors and some have similar clocked octa core. Which is better one in terms of performance?</a></p>
</li>
</ul>
</section>
<footer class="page__meta">
<p class="page__taxonomy">
<strong><i class="fas fa-fw fa-tags" aria-hidden="true"></i> Tags: </strong>
<span itemprop="keywords">
<a href="/tag/android" class="page__taxonomy-item" rel="tag">android</a><span class="sep">, </span>
<a href="/tag/stack-exchange" class="page__taxonomy-item" rel="tag">stack-exchange</a>
</span>
</p>
<p class="page__date"><strong><i class="fas fa-fw fa-calendar-alt" aria-hidden="true"></i> Updated:</strong> <time datetime="2019-06-17">June 17, 2019</time></p>
</footer>
<section class="page__share">
<a href="https://twitter.com/intent/tweet?text=Some+ideas+about+multicore+on+Android%20https%3A%2F%2Fibugone.com%2Fblog%2F2017%2F06%2Fandroid-phone-cores%2F" class="btn btn--twitter" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="Share on Twitter"><i class="fab fa-fw fa-twitter" aria-hidden="true"></i><span> Twitter</span></a>
<a href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fibugone.com%2Fblog%2F2017%2F06%2Fandroid-phone-cores%2F" class="btn btn--facebook" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="Share on Facebook"><i class="fab fa-fw fa-facebook" aria-hidden="true"></i><span> Facebook</span></a>
<a href="https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fibugone.com%2Fblog%2F2017%2F06%2Fandroid-phone-cores%2F" class="btn btn--linkedin" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="Share on LinkedIn"><i class="fab fa-fw fa-linkedin" aria-hidden="true"></i><span> LinkedIn</span></a>
</section>
<nav class="pagination">
<a href="/blog/2009/11/regex-match-open-tags-except-xhtml-self-contained-tags/" class="pagination--pager" title="RegEx match open tags except XHTML self-contained tags
">Previous</a>
<a href="/blog/2017/08/append-int-to-stdstring/" class="pagination--pager" title="Append int to std::string
">Next</a>
</nav>
</div>
<div class="page__comments">
<h4 class="page__comments-title">Comments</h4>
<section id="disqus_thread"></section>
</div>
</article>
<div class="page__related">
<h4 class="page__related-title">You May Also Enjoy</h4>
<div class="grid__wrapper">
<div class="grid__item">
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
<h2 class="archive__item-title" itemprop="headline">
<a href="/blog/2020/04/ssh-8.2-rsa-ca/" rel="permalink">Use RSA CA Certificates with OpenSSH 8.2
</a>
</h2>
<p class="page__meta">
<span style="margin-right: 1em;">
<i class="far fa-calendar-alt" aria-hidden="true"></i> April 7, 2020
</span>
<i class="far fa-clock" aria-hidden="true"></i>
22 minute read
</p>
<p class="archive__item-excerpt" itemprop="description">OpenSSH 8.2 is coming to the latest Long-Term Service release of Ubuntu, Focal Fossa (20.04), and has some breaking changes for users using an SSH Certificate Authority.
</p>
</article>
</div>
<div class="grid__item">
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
<h2 class="archive__item-title" itemprop="headline">
<a href="/blog/2020/02/use-mysql-cli-without-password/" rel="permalink">3 ways to use MySQL / MariaDB CLI without password
</a>
</h2>
<p class="page__meta">
<span style="margin-right: 1em;">
<i class="far fa-calendar-alt" aria-hidden="true"></i> February 4, 2020
</span>
<i class="far fa-clock" aria-hidden="true"></i>
24 minute read
</p>
<p class="archive__item-excerpt" itemprop="description">For all of us who are learning to use or developing with MySQL or MariaDB, it’s a common task to manually log in to the database for inspection. This is usually done with the mysql command line client, and for sure it’s cumbersome to log in to the database using your application’s credentials. Fo...</p>
</article>
</div>
<div class="grid__item">
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
<h2 class="archive__item-title" itemprop="headline">
<a href="/blog/2019/12/mass-crawl-douban-with-aws/" rel="permalink">High-performance mass web crawling on AWS
</a>
</h2>
<p class="page__meta">
<span style="margin-right: 1em;">
<i class="far fa-calendar-alt" aria-hidden="true"></i> December 28, 2019
</span>
<i class="far fa-clock" aria-hidden="true"></i>
93 minute read
</p>
<p class="archive__item-excerpt" itemprop="description">The 3rd-and-last experiment of course Web Information Processing and Application required us to create a recommendation engine, and “predict” the rating (1-5 stars) for 4M user-item pairs based on the training data of 9M user-item pairs and a social network.
</p>
</article>
</div>
<div class="grid__item">
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
<h2 class="archive__item-title" itemprop="headline">
<a href="/blog/2019/12/manage-servers-with-ssh-ca/" rel="permalink">Managing servers with OpenSSH Certificate Authority
</a>
</h2>
<p class="page__meta">
<span style="margin-right: 1em;">
<i class="far fa-calendar-alt" aria-hidden="true"></i> December 23, 2019
</span>
<i class="far fa-clock" aria-hidden="true"></i>
39 minute read
</p>
<p class="archive__item-excerpt" itemprop="description">Since the addition of the website server for an external corporation, I now have 5 Linux servers to manage on my own. I also have 4 terminal devices that I use to connect to those servers: two of my laptops, my Android phone (using Termux), and one of those servers that I use as a workstation.
</p>
</article>
</div>
</div>
</div>
</div>
</div>
<div class="search-content">
<div class="search-content__inner-wrap">
<div class="search-searchbar"></div>
<div class="search-hits"></div>
</div>
</div>
<div id="footer" class="page__footer">
<footer>
<!-- start custom footer snippets -->
<!-- end custom footer snippets -->
<div class="page__footer-follow">
<ul class="social-icons">
<li><a href="https://github.com/iBug" rel="nofollow noopener noreferrer"><i class="fab fa-fw fa-github" aria-hidden="true"></i> GitHub</a></li>
<li><a href="https://stackoverflow.com/users/5958455/ibug" rel="nofollow noopener noreferrer"><i class="fab fa-fw fa-stack-overflow" aria-hidden="true"></i> Stack Overflow</a></li>
<li><a href="/feed.xml"><i class="fas fa-fw fa-rss-square" aria-hidden="true"></i> Feed</a></li>
</ul>
</div>
<div class="page__footer-copyright">
© 2020 iBug. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.
<br>
Except otherwise noted, content on this site is licensed under the <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0 License</a>. Attribution required.
<br>
<a href="/privacy-policy">Privacy Policy</a> | <a href="/sitemap.xml">Sitemap (XML)</a>
<br>
Site version <a href="/status">G-175</a>
</div>
</footer>
</div>
<script src="/assets/js/main.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5/js/all.min.js" async defer type="text/javascript"></script>
<!-- Including InstantSearch.js library and styling -->
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@2.3.3/dist/instantsearch.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.3.3/dist/instantsearch.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.3.3/dist/instantsearch-theme-algolia.min.css">
<script>
// Instanciating InstantSearch.js with Algolia credentials
const search = instantsearch({
appId: '14DZKASAEJ',
apiKey: 'a0d8cb9da2d6ad0d17dcd40c58c72a56',
indexName: 'iBug_website',
searchParameters: {
restrictSearchableAttributes: [
'title',
'content'
]
}
});
const hitTemplate = function(hit) {
const url = hit.url;
const title = hit._highlightResult.title.value;
const content = hit._highlightResult.html.value;
return `
<div class="list__item">
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
<h2 class="archive__item-title" itemprop="headline"><a href="${url}">${title}</a></h2>
<div class="archive__item-excerpt" itemprop="description">${content}</div>
</article>
</div>
`;
}
// Adding searchbar and results widgets
search.addWidget(
instantsearch.widgets.searchBox({
container: '.search-searchbar',
poweredBy: true,
placeholder: 'Enter your search term...'
})
);
search.addWidget(
instantsearch.widgets.hits({
container: '.search-hits',
templates: {
item: hitTemplate
}
})
);
// Starting the search
search.start();
</script>
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-115907213-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script>
var disqus_config = function () {
this.page.url = "https://ibugone.com/blog/2017/06/android-phone-cores/"; /* Replace PAGE_URL with your page's canonical URL variable */
this.page.identifier = "/blog/2017/06/android-phone-cores"; /* Replace PAGE_IDENTIFIER with your page's unique identifier variable */
};
(function() { /* DON'T EDIT BELOW THIS LINE */
var d = document, s = d.createElement('script');
s.src = 'https://ibugone.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</body>
</html>