Urgent.News

What's breaking now, across thousands of outlets.

Tech

No measurement, no optimization

No measurement, no optimization. There's a common saying in programming: "Don't optimize what you haven't measured yet." You can only truly appreciate this advice when you experience it yourself. And I definitely did. I'm always looking forward to projects where I can optimize the code after the first release. It's really satisfying to refine code and make it cleaner and more efficient. But I've…

No measurement, no optimization. This adage holds true in programming, where it's crucial not to optimize code before measuring its current performance. The author of this story learned this lesson the hard way during a recent project. While they enjoyed the prospect of refining code and enhancing efficiency post-release, they discovered the consequences of optimization without measurement could be disastrous.

Most performance issues in their project stemmed from database queries, not architectural flaws. After the initial release, the author identified two particularly complex queries that they intended to optimize. They planned to combine the queries for efficiency, but upon testing, they realized the combined version had a higher average response time than the original implementation.

The author conducted a performance test using Postman, sending 100 requests to calculate the average response time. While some requests were indeed faster than the old version, there were significant spikes, indicating the new implementation wasn't uniformly better. The author attributed the regression to an oversight in understanding the structure of the data and its data types, which unexpectedly impacted performance.

This experience taught them the importance of Laravel performance tools, the utility of Postman in this context, and the necessity of researching potential performance regressions. The author concluded that while optimization based on instinct can be a starting point, it must be validated with accurate measurements. As the saying goes, you can only call it optimized if you have the benchmarks to prove it!

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

New Portfolio in the Works

New Portfolio in the Works. I’ve always wanted a cool, chibi-style profile picture for my portfolio, but I've never been good at drawing.

  • Designer created portfolio with Ghibli-style image generator.
  • Inspired by modern techy design, aiming for warmer aesthetic.
  • Focused on legibility and responsiveness across devices.

Installing and setting up Postgres in Ubuntu

At work, we handle a lot of short-term projects, typically lasting 3-8 weeks. These projects don't require a complex deployment setup.

  • Install PostgreSQL and contrib modules using sudo apt install postgres postgresql-contrib.
  • Create a new user with sudo su postgres and run createuser interactively.
  • Grant necessary permissions with GRANT commands after setting the user's password.

Hello, world!

Finally! My personal blog pings the world of the internet with a hearty "Hello, world!" It honestly took me a while to buckle down and do it, but after a bunch of pins on Pinterest and checking out…

  • Author created personal blog with "Hello, world!" message
  • Chose NuxtJS and VueJS for frontend development
  • Deployed site on Digital Ocean VPS with Cloudflare security

Suspend, Background, Disown

I'm currently working on a hobby project, using crawlers to download media files for a dataset. Some of these are large files that also need preprocessing.

  • Press CTRL + Z to suspend a running process.
  • Resume suspended process in background with 'bg'.
  • Disown process using 'disown -h %1' for independence.

More from Sunday 27 September →