Image for post
Image for post
String.replaceAll

In this post, we will discuss the usage of another prevalent code constructions, the String.replaceAll and String.replace methods, and we will investigate how it affects the performance of your code in Java 11 and what you can do about it.

(Please consider all the code below from the point of performance)

(Please don’t focus on numbers, they are just metrics to prove the point)

String.replaceAll

I wouldn’t say I like to make up the examples, so this time, we’ll start right away from the existing codebase of the Spring Framework. …


Image for post
Image for post

Enums are crucial part of every application larger than “Hello World“. We use them everywhere. They are actually very useful: they restrict the input, allow you to compare the values by the reference, provide compile-time checks, and make the code easier to read. However, using Enums has a few performance downsides. And we’ll review them in this post.

(Please consider all the code below from the point of performance)

(Please do not focus on numbers, they are just examples to prove the point)

Enum.valueOf

In Blynk, one of the most popular features is called “Widget Property”. It’s when you can change…


Image for post
Image for post

So, in the previous post, we considered two approaches to improve the performance of the well-known String.equals() method. Now, we’ll look into two other String class methods that you are using every day.

(Please consider all the below code from the point of performance)

(Please do not focus on numbers, these are just examples to prove the point)

equalsIgnoreCase

As usual, we’ll start with the very simple and basic code. This code is pretty common for web servers that have HTTP API and expect some kind of a parameter:

if ("hello world".equals(param.toLowerCase())) {}

What is wrong here?

It’s pretty obvious…


Image for post
Image for post

Hello everybody, my name is Dmytro Dumanskiy, I’m a CTO and Co-Founder at Blynk, an Internet of Things platform for businesses. We work hard on making it simple for businesses to connect their electronic devices to the Internet and build white-label apps to monitor and control them remotely. This is my first article in English, so please excuse me for any mistakes.

In the early days of our product, we had to optimize our back-end infrastructure, again and again, to spend less on the servers. …

Dmytro Dumanskiy

CTO an Co-Founder at https://blynk.io/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store