2. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
iOS developer
Who’s speaking?
2009
Android developer2010
Cross-platform developer2011
Instructor on mobile apps development
for 5 years2012
VRIJE
UNIVERSITEIT
AMSTERDAM
2014
2016
Experiments at the
GREEN LAB
Empirical research on hybrid apps
2017
3. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
The Green Lab
Our platform for researching
on software
– energy efficiency
– performance
Students measure
real software solutions
OpenSTF
+ ADB
Serve
web pages
VMWare
manager
SSH
MEASURES
Wifi
network
Router
Experiment
orchestrator
OpenSTF
Web
interface
Power
meters
A PLATFORM
A COURSE
5. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Deep dive into mobile apps development
Ivano Malavolta (2016). Web-based hybrid mobile apps: state of the practice and research opportunities. In
Proceedings of the International Conference on Mobile Software Engineering and Systems, MOBILESoft '16
Ivano Malavolta (2016). Beyond Native Apps: Web Technologies to the Rescue! (Keynote). In Proceedings of the
1st International Workshop on Mobile Development (Mobile!)
11. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
• fast development
• simple maintenance and updates
• cross-platform
• 2-steps access
– they are launched via a browser
• do not work offline
• no background activities
– geofencing
• poor access to system APIs
– push notifications, contacts, etc.
Web apps
PROS
CONS
14. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Web-based hybrid apps
• cross-platform portability
• reuse of existing knowledge of web
developers
• simpler and less expensive development
process
• inherit some cons of native apps
• restricted access to system APIs
• (slight) decrease in performance
PROS
CONS
18. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
The journey of a PWA
1. The user accesses the website as
usual
2. After the 3rd-4th visit, the website
asks to be installed
3. The user can decide to add the app
to the home screen
https://goo.gl/KIZydg
19. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
The journey of a PWA
1. The user accesses the website as
usual
2. After the 3rd-4th visit, the website
asks to be installed
3. The user can decide to add the app
to the home screen
4. From now on, the app is top-level,
full-screen, and can receive push
notifications
https://goo.gl/KIZydg
20. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Components of a PWA
HTTPS
Web
Manifest
Service
workers
{
"name": "MyApplication",
"short_name": "MyApp",
"scope": "./webApp/",
"orientation": "portrait",
"display": "fullscreen",
"background_color": "#fff",
"description": "A simple application for testing.",
"icons": [{
"src": "images/touch/homescreen48.png",
"sizes": "48x48",
"type": "image/png"
}, ...
}],
...
}
23. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Energy consumption
(of progressive web apps)
Ivano Malavolta, Giuseppe Procaccianti, Paul Noorland, Petar Vukmirovic. Assessing the Impact of Service
Workers on the Energy Efficiency of Progressive Web Apps. In Proceedings of the International
Conference on Mobile Software Engineering and Systems, MOBILESoft 2017,
24. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
PWAs have been advertised as:
• performance boosters
• network savers
• providers of better UX
However…
How does the use of service workers impact the
energy efficiency of PWAs under different network
conditions?
How does the use of service workers impact the
energy efficiency of PWAs?RQ1
RQ2
25. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
PWAs selection
• Real PWAs from the pwa.rocks1 repository
• Pseudo-random selection
– no toy examples
– data-driven PWAs (aka no videogames)
1 https://pwa.rocks
Name Category Total
size
SW size
(loc)
Ali Express Shopping 2.1Mb 69
Google I/O 2016 Events 4.2Mb 358
The Washington Post News 4.0Mb 85
Flipkart Shopping 3.8Mb 907
Babe News News 1.2Mb 156
Wiki offline Knowledge 800Kb 1009
The Billings Gazette News 2.1Mb 60
27. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Experiment design
• full 2x2x2 factorial à all possible combinations of
treatments
• 8 combinations x 7 PWAs x 8 runs
à
• each run executes a typical usage
scenario (10-15 gestures)
448 runs
SW status Device Network
on low-end 2G
on low-end WiFi
on high-end 2G
on high-end WiFi
off low-end 2G
off low-end WiFi
off high-end 2G
off high-end WiFi
28. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
7a. HTTP
requests as part
of the scenario
Mobile device
Server
Measurement infrastructure
Orchestration
script
Monkey
runner
Trepn
profiler
Chrome
Monkeyrunner
1. HTTP requests
impersonating phone
2. HTTP responses (recorded)
9. save
collected
data
3. Start experiment run
5. start 6. start
7b. HTTP
responses
(possibly altered)
8. collect data
Fiddler
proxy
Hosted
PWA
ADB
OS
4. start
scenario
run
34. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Results of manual review
No specific trend here
Name Listened
events
Caching Obfuscation/
minification
Complexity
Ali Express P, N ✓ ✓ 12
Google I/O 2016 I, A, F, M ✓ 9
The Washington Post I, A, P, N ✓ 131
Flipkart I, A, F ✓ ✓ 5
Babe News I, A, F, P, N ✓ 16
Wiki offline I, A, F, S, M, N ✓ ✓ 7
The Billings Gazette I, A, F ✓ 194
35. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Conclusions
Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
PWAs have been advertised as:
• performance boosters
• network savers
• providers of better UX
However…
Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
7a. HTTP
requests as part
of the scenario
Mobile device
Server
Measurement infrastructure
Orchestration
script
Monkey
runner
Trepn
profiler
Chrome
Monkeyrunner
1. HTTP requests
impersonating phone
2. HTTP responses (recorded)
9. save
collected
data
3. Start experiment run
5. start 6. start
7b. HTTP
responses
(possibly altered)
8. collect data
Fiddler
proxy
Hosted
PWA
ADB
OS
4. start
scenario
run
Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Results: SW-on VS SW-off
Low-end High-end
Smaller difference in the high-end device
Service workers DO NOT influence the energy
consumption of a PWA running on a mobile device
36. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Performance
(of native apps)
Teerath Das, Massimiliano Di Penta, Ivano Malavolta. A Quantitative and Qualitative Investigation of
Performance-Related Commits in Android Apps. In 2016 IEEE International Conference on Software
Maintenance and Evolution (ICSME 2016)
43. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Open card sorting
– 2 people performed the task, a third one checked the results
1st phase
commits tagged based on keywords
e.g., read from file system, swipe lag
2nd phase
commits clustered into meaningful,
labeled groups
45. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
User interface
• Applied solutions:
– use of Android’s recycled views instead of plain list views
– render images in slices
– ...
Problems related to swipe lags, screen layout drawing, lists
scrolling responsiveness
FIX layouts for better rendering performance
46. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Code smells
• Applied solutions:
– use more efficient regular expressions
– avoid recurrent computations of constant data
– avoid usage of deprecated decryption algorithms
– ...
Symptoms of poor design and implementation choices
fixed string concatenation performance issue
47. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Memory
• Applied solutions:
– stopping auxiliary services when available memory gets low
– avoiding to load potentially unused data
– ...
Related to the memory footprint of the app
Fixed major memory leak;
should improve responsiveness on older devices
48. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Local database access
• Applied solutions:
– perform queries in an asynchronous task
– add indexes to specific fields
– ...
Access to local database can be highly inefficient
Added indexes for post.blogID to improve
performance of several lookups
50. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
User perceptions
(of hybrid apps)
Ivano Malavolta, Stefano Ruberto, Tommaso Soru, Valerio Terragni. Hybrid Mobile Apps in the Google
Play Store: An Exploratory Investigation. 2nd ACM International Conference on Mobile Software
Engineering and Systems (MOBILESoft 2015).
Ivano Malavolta, Stefano Ruberto, Valerio Terragni, Tommaso Soru. End Users’ Perception of Hybrid
Mobile Apps in the Google Play Store. IEEE International Conference on Mobile Services (MS 2015).
51. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Pros
• cross-platform portability
• reuse of existing knowledge of
web developers
• simpler and less expensive
development processes
Hybrid mobile apps
Cons
• restricted access to hardware
features
• decrease in performance
• variations on user experience
As of today, limited empirical investigations
have been performed on hybrid mobile apps
Strong debate about benefits and drawbacks
53. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Data extraction
Classified apps
(hybrid vs native)
Hybrid apps
classifier*
top-500 most popular free apps for
each category of the Google Play
Store
~11k app binaries
Apps and
reviews
mining
* analysis tool available here:
http://github.com/GabMar/ApkCategoryChecker
56. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Data extraction
Classified apps
(hybrid vs native)
Hybrid apps
classifier*
Reviews
analyzer
top-500 most popular free apps for
each category of the Google Play
Store
~11k app binaries
50 pages (~255) of
reviews for each app
~3M user
reviews
apps scores
Apps and
reviews
mining
perceived value: 0.5
users sentiment: 0.6
#reviews: 243
performance: 0.6
bugginess: 0.1
size: 3,456 kb* analysis tool available here:
http://github.com/GabMar/ApkCategoryChecker
57. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Reviews analysis
Stopwords
removal
manually performed
by 2 domain experts
Single review
Single review
score
polaritypos: 0.8 performancepos: 0.6
polarityneg: 0.1 performanceneg: 0.05
bugginess: 0.2
300 random
reviews
Keywords
extraction
Relevant keywords
Lemmatization
Tf-idf based
vectors similarity
computation
60. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Perceived value
Average review count
where Ra ∈ ℕ
Native apps have been reviewed in average 6.5
times more than hybrid mobile apps
Possible interpretation:
hybrid mobile apps are neither perceived as too
satisfying nor dissatisfying w.r.t. native ones
62. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Perceived bugginess
where buga = #reviews signalling the presence of bugs or failures
reviewsa = #reviews of the app
The highest unbalance between the two
development strategies in our study
bugginessa = buga / reviewsa
Possible interpretation:
absence of full-fledged testing frameworks for hybrid
apps, such as those provided by native apps IDEs like
Eclipse and Android Studio
64. Ivano Malavolta
VRIJE
UNIVERSITEIT
AMSTERDAM
Data extraction
Classified apps
(hybrid vs native)
Hybrid apps
classifiers
Reviews
analyzer
top-500 most popular free apps for
each category of the Google Play Store
~11k app binaries
50 pages (~255) of
reviews for each app
~3M app
reviews
apps scores
Apps and
reviews
mining
perceived value: 0.5
users sentiment: 0.6
#reviews: 243
performance: 0.6
bugginess: 0.1
size: 3,456 kb
Apache Cordova (258) and Appcelerator Titanium (116)
Developers reuse JavaScript frameworks for the desktop web
End users value hybrid and native apps similarly
Hybrid may be good for data-intensive apps, whereas it performs poorly when
dealing with low-level, platform-specific features
Reviews analysis
Stopwords
removal
manually performed
by 2 domain experts
Single review
Single review
score
polaritypos
: 0.8 performancepos
: 0.6
polarityneg
: 0.1 performanceneg
: 0.05
bugginess: 0.2
300 random
reviews
Keywords
extraction
Relevant keywords
Lemmatization
Tf-idf based
vectors similarity
computation