Mastering High Performance with Kotlin
Overcome performance difficulties in Kotlin with a range of exciting techniques and solutions
Igor Kucherenko
BIRMINGHAM - MUMBAI
Mastering High Performance with Kotlin
Copyright 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Richa Tripathi
Acquisition Editor: Sandeep Mishra
Content Development Editor: Zeeyan Pinheiro
Technical Editor: Ruvika Rao
Copy Editor: Safis Editing
Project Coordinator: Vaidehi Sawant
Proofreader: Safis Editing
Indexer: Tejal Daruwale Soni
Graphics: Jason Monteiro
Production Coordinator: Shraddha Falebhai
First published: June 2018
Production reference: 1120618
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78899-664-8
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Igor Kucherenko is an Android developer at Techery, a software development company that uses Kotlin as the main language for Android development. Currently, he lives in Ukraine, where he is a speaker in the Kotlin Dnipro Community, which promotes Kotlin and shares knowledge with audiences at meetups. You can find his articles about Kotlin and Android development on Medium and a blog for Yalantis, where he worked previously.
I'd like to thank my colleague for sharing knowledge, and Packt Publishing for the opportunity to write this book; Russell Snyder for his help with many details; my wife for her patience while I was writing this book.
About the reviewer
Ganesh Samarthyam is a co-founder of CodeOps Technologies, a software technology, consultancy, and training company based in Bangalore. He has 16 years of experience in the IT industry, and his latest book, Refactoring for Software Design Smells: Managing Technical Debt by Morgan Kaufmann/Elsevier, has been translated to languages such as Korean and Chinese. Ganesh loves exploring anything and everything about technology in his free time.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
Kotlin is a statically typed programming language that is designed to interoperate with Java code. Since the kotlinc compiler generates the same bytecode as javac, migrating to a new code base doesn't require a lot of effort. Kotlin is a modern language that contains many features from different paradigms that allow you to write concise and safe code. In light of all these points, Kotlin is growing in popularity and increasing in the number of developers who use it.
The book starts by analyzing different performance metrics and debugging tools that help us to identify performance bottlenecks. It's important to understand how Kotlin and its modern features work under the hood; that's why we will inspect a lot of bytecode in the book. We will learn how to benchmark our code and avoid different types of resource leaks. The book ends with best practices that will help you to sum up all things that you've learned.
Who this book is for
This book is for developers who would like to gain deeper understanding of how Kotlin works under the hood. The material doesn't depend on a certain platform of framework, but it focuses on Java Virtual Machine. This book doesn't cover topics about Kotlin to JavaScript feature and Kotlin/Native. It's a good choice for client-side developers because it contains examples with user interfaces and multithreaded environments.
What this book covers
, Identifying Performance Bottlenecks , covers the reasons for performance issues and how they can impact the user experience and performance of the whole software product. It is an overview of the issues this book aims to resolve, and prepares the reader for the details of these issues in subsequent chapters.
, Identifying Performance Issues , presents p erformance as one of the leading challenges you will encounter while building any software application. Response speed is one of the critical criteria to analyze performance issues, and it closely correlates with the success of that software in the market. We can use different parameters to identify problems depending on the architecture and what technology is used in the implementation.
, Learn How to Use Profiling Tools , introduces various techniques of troubleshooting application code. We will look at the different profiling tools that measure space of memory, the frequency and duration of function calls, and which software is included in the IntelliJ IDEA platform for this purpose.
Next page