Loading
Current section: Performance 6 exercises
lesson

Performance Introduction

Performance issues in tests often creep in slowly—what feels fine with ten tests can become unbearable with hundreds. In this block, I’ll walk you through how Vitest runs under the hood, why worker processes matter, and how to profile CPU and memory use. You’ll learn practical techniques to track down bottlenecks and keep your suite running fast as it grows.

Loading lesson

Transcript

00:00 Throughout these exercises, we've been talking about automated testing, and the automated part means that we're able to express what we expect our software to do in code. And as a result, we can get this quality check performed much faster, because computers can interact with

00:15 our software much faster than humans can. So how come our tests can get so slow sometimes? Well, the reasons for performance degradation in tests are multiple, from testing the system that's inherently slow by itself, to introducing inefficient test setups, not utilizing your testing framework to the fullest, or simply having too many tests.

00:33 But no matter the reason, you need to know how to spot and inspect performance degradation when it happens, and also know how to address it. And that is exactly what you're going to learn in this exercise block. But before we talk about this, we need to take a step back. We need to understand how VTEST orchestrates your test run, so you know which exact area to improve.

00:51 I will show you how to use built-in tools in VTEST, as well as third-party tools, to know exactly what makes your tests slow. And after that, we're going to explore some of the VTEST configuration options that could improve test performance, in some cases making tests up to 40 times faster. And as amazing as this optimization sounds, it is not without a cost.

01:08 In fact, VTEST will ask one important thing from you. So what are you waiting for? Head to the first exercise to learn more about test performance.