{
  "id": 17388653,
  "title": "I Optimized a Button From O(n) to O(1). The Speed Didn't Matter.",
  "url": "https://urgent.news/2026/10/31/i-optimized-a-button-from-o-n-to-o-1-the-speed-didnt-matter",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-31T11:12:52.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/mohsenfallahnjd/i-optimized-a-button-from-on-to-o1-the-speed-didnt-matter-43o7"
  },
  "original_language": "en",
  "account": "A bug report was received: audit logs from the Users page showed nothing. The Users list contains a button that triggered a search for an id from the URL. The button was present on multiple pages of the admin panel and took no props. The button used a map to search route prefixes to log types. The button's code was found to have a linear search, which had a time complexity of O(n). The author wanted to make the button faster, so they started thinking in Big O notation and tried to optimize the search. However, they discovered that the input size was small and fixed, so the linear search was not a significant issue. The author then tried to optimize the button by using a hash map, which would have an average time complexity of O(1). However, they found that the new implementation was actually slower than the original one, even though it had a better time complexity. The author concluded that the best algorithm is sometimes deleting the question, rather than finding a perfect solution.",
  "summary": "A bug report, a route map, and three rounds of making it faster — a story about what Big O really measures, why constants win at small n, and why the best algorithm is sometimes deleting the question. The bug report was one line long: \"Audit logs from the Users page show nothing.\" I opened the Users list, clicked Audit logs , and landed here: /audit-logs?type=Users&ResourceId=users…",
  "key_points": [
    "Original button had O(n) time complexity",
    "Optimized with hash map to O(1) average time",
    "Author concluded best algorithm may be deleting question"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}