Why useNavigate hook in react-router v6 triggers waste re-renders and how to solve it

While optimizing performance in one of my React.js projects I stumbled upon components re-rendering for no apparent reason whatsoever. After some experiments the culprit was found: import { useNavigate } from "react-router-dom" // v6 const Component = () => { const navigate = useNavigate() ... } Turns out that if you use the useNavigate hook in a component, it will re-render on every call to navigate() or click on <Link />, even if the path has not changed....

2022-04-28 · 3 min

Performance of application-defined functions and collations in SQLite

When writing the post on Unicode case-insensitive search in SQLite I got interested in the performance of application-defined functions and collations: they must introduce overhead, the question is how much and whether it is something to be concerned about. To answer these questions I made a simple test suite measuring the performance of both built-in SQLite and application-defined functions and collations – the full code is at the very end of the post....

2022-01-26 · 10 min

5 ways to implement case-insensitive search in SQLite with full Unicode support

Recently I needed a case-insensitive search in SQLite to check if an item with the same name already exists in one of my projects – listOK. At first, it looked like a simple task, but upon deeper dive, it turned out to be easy, but not simple at all, with many twists and turns. Built-in SQLite capabilities and their drawbacks In SQLite you can get a case-insensitive search in three ways:...

2022-01-10 · 13 min

Are python comprehensions faster than loops, why, and does it matter?

Python comprehensions are believed to be faster for generating collections than for loops. The question is why are they faster? What part of a comprehension is faster than in the loop? Below we answer this question and whether their faster performance is something worth considering. This will be more of an exploratory exercise, where the journey and methodology are more interesting than the destination. If you need only the conclusions, you can jump there....

2021-11-15 · 8 min