Book Image

Mastering High Performance with Kotlin

Book Image

Mastering High Performance with Kotlin

Overview of this book

The ease with which we write applications has been increasing, but with it comes the need to address their performance. A balancing act between easily implementing complex applications and keeping their performance optimal is a present-day requirement In this book, we explore how to achieve this crucial balance, while developing and deploying applications with Kotlin. The book starts by analyzing various Kotlin specifcations to identify those that have a potentially adverse effect on performance. Then, we move on to monitor techniques that enable us to identify performance bottlenecks and optimize performance metrics. Next, we look at techniques that help to us achieve high performance: memory optimization, concurrency, multi threading, scaling, and caching. We also look at fault tolerance solutions and the importance of logging. We'll also cover best practices of Kotlin programming that will help you to improve the quality of your code base. By the end of the book, you will have gained some insight into various techniques and solutions that will help to create high-performance applications in the Kotlin environment
Table of Contents (12 chapters)

To get the most out of this book

To run examples from this book, you will need a computer running Windows, Linux, or Mac OS. You also need IntelliJ IDEA (Ultimate edition version is preferable) and Android Studio. You need basic knowledge of GitHub and Git to clone a project with examples.

Since Kotlin is an official language for Android development, Android Studio supports this language out of the box. For IntelliJ IDEA you need to install a plugin that is available for download from https://plugins.jetbrains.com/plugin/6954-kotlin.

Download the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packtpub.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Mastering-High-Performance-with-Kotlin. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "To override finalize(), all you need to do is simply declare it without using the override keyword (and it can't be private)."

A block of code is set as follows:

class C {
protected fun finalize() {
// finalization logic
}
}

Any command-line input or output is written as follows:

computation
CacheThread 8
NetworkThread 8

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "The IntelliJ IDEA has a special function for this. Go to the CalculatorMachine class and open the Generate pane."

Warnings or important notes appear like this.
Tips and tricks appear like this.