# programming

**URL:** https://forum.kirupa.com/c/programming/41.md?page=14

[Latest](https://forum.kirupa.com/latest.md) · [Categories](https://forum.kirupa.com/categories.md)

**Page:** 15

---

## [Why is this rate limiter letting extra requests through?](https://forum.kirupa.com/t/why-is-this-rate-limiter-letting-extra-requests-through/680162)

<div class="topic-metadata">

**Author:** [@Ellen1979](https://forum.kirupa.com/u/Ellen1979)\
**Replies:** 3\
**Last updated:** [April 8, 2026, 12:00am UTC](https://forum.kirupa.com/t/why-is-this-rate-limiter-letting-extra-requests-through/680162 "2026-04-08T00:00:12Z")

</div>

Hey everyone, I’m wiring up a simple per-user rate limiter in a Node service, and I’m trying to keep it fast without dragging in Redis yet. The problem is it mostly works, but around the window boundary a user sometimes …

---

## [Why does my canvas animation slowly drift out of sync on 120hz screens?](https://forum.kirupa.com/t/why-does-my-canvas-animation-slowly-drift-out-of-sync-on-120hz-screens/680175)

<div class="topic-metadata">

**Author:** [@Baymax](https://forum.kirupa.com/u/Baymax)\
**Replies:** 2\
**Last updated:** [April 7, 2026, 11:56pm UTC](https://forum.kirupa.com/t/why-does-my-canvas-animation-slowly-drift-out-of-sync-on-120hz-screens/680175 "2026-04-07T23:56:07Z")

</div>

Hey everyone, I’m working on a tiny pixel-art runner in canvas, and on my laptop it looks fine at first but after a minute the walk cycle and movement feel slightly out of sync on a 120hz display. I tried keeping movemen…

---

## [Why is this memoized selector still causing extra renders?](https://forum.kirupa.com/t/why-is-this-memoized-selector-still-causing-extra-renders/680171)

<div class="topic-metadata">

**Author:** [@BobaMilk](https://forum.kirupa.com/u/BobaMilk)\
**Replies:** 2\
**Last updated:** [April 7, 2026, 11:35pm UTC](https://forum.kirupa.com/t/why-is-this-memoized-selector-still-causing-extra-renders/680171 "2026-04-07T23:35:14Z")

</div>

Hey everyone, I’m working on a small React UI and trying to cut render cost while profiling, but one panel still rerenders a lot and it makes scrolling feel a bit jittery. import { useMemo } from "react"; function Side…

---

## [Why does my optimistic update sometimes get overwritten by older fetch results?](https://forum.kirupa.com/t/why-does-my-optimistic-update-sometimes-get-overwritten-by-older-fetch-results/680173)

<div class="topic-metadata">

**Author:** [@ArthurDent](https://forum.kirupa.com/u/ArthurDent)\
**Replies:** 1\
**Last updated:** [April 7, 2026, 10:21pm UTC](https://forum.kirupa.com/t/why-does-my-optimistic-update-sometimes-get-overwritten-by-older-fetch-results/680173 "2026-04-07T22:21:32Z")

</div>

Hey everyone, I’m wiring up a tiny product list UI and trying to make deletes feel instant, but now and then an older fetch result strolls in and puts the item back like nothing happened. let state = { items: \[\] }; let …

---

## [Why does this sliding window count too many substrings?](https://forum.kirupa.com/t/why-does-this-sliding-window-count-too-many-substrings/680149)

<div class="topic-metadata">

**Author:** [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Replies:** 3\
**Last updated:** [April 7, 2026, 9:56pm UTC](https://forum.kirupa.com/t/why-does-this-sliding-window-count-too-many-substrings/680149 "2026-04-07T21:56:08Z")

</div>

Hey everyone, I’m working on a small string parser right now and trying to count substrings with at most 2 distinct characters, but my window logic starts overcounting once the left side moves. I wanted the fast O(n) app…

---

## [Why does my sprite sheet jump to the wrong frame at low FPS?](https://forum.kirupa.com/t/why-does-my-sprite-sheet-jump-to-the-wrong-frame-at-low-fps/680164)

<div class="topic-metadata">

**Author:** [@sarah\_connor](https://forum.kirupa.com/u/sarah_connor)\
**Replies:** 2\
**Last updated:** [April 7, 2026, 8:56pm UTC](https://forum.kirupa.com/t/why-does-my-sprite-sheet-jump-to-the-wrong-frame-at-low-fps/680164 "2026-04-07T20:56:09Z")

</div>

Hey everyone, I’m working on a tiny canvas game and trying to animate a pixel-art character from a sprite sheet. It looks fine most of the time, but when the tab lags or FPS drops, the animation skips weirdly and sometim…

---

## [How should I smooth sprite movement without making pixel art shimmer?](https://forum.kirupa.com/t/how-should-i-smooth-sprite-movement-without-making-pixel-art-shimmer/680169)

<div class="topic-metadata">

**Author:** [@BobaMilk](https://forum.kirupa.com/u/BobaMilk)\
**Replies:** 1\
**Last updated:** [April 7, 2026, 8:07pm UTC](https://forum.kirupa.com/t/how-should-i-smooth-sprite-movement-without-making-pixel-art-shimmer/680169 "2026-04-07T20:07:15Z")

</div>

Hey everyone, I’m working on a small canvas pixel-art game and trying to smooth camera and sprite movement, but my sprites start shimmering when I interpolate positions. If I round everything, motion looks choppy. If I k…

---

## [Why do my pixel art sprites look blurry when the camera moves?](https://forum.kirupa.com/t/why-do-my-pixel-art-sprites-look-blurry-when-the-camera-moves/680167)

<div class="topic-metadata">

**Author:** [@Baymax](https://forum.kirupa.com/u/Baymax)\
**Replies:** 3\
**Last updated:** [April 7, 2026, 7:11pm UTC](https://forum.kirupa.com/t/why-do-my-pixel-art-sprites-look-blurry-when-the-camera-moves/680167 "2026-04-07T19:11:17Z")

</div>

Hey everyone, I’m working on a small canvas platformer and trying to keep the pixel art crisp while the camera follows the player, but as soon as movement gets smooth the tiles and sprites start looking blurry and kind o…

---

## [When is denormalizing product data worth the sync pain?](https://forum.kirupa.com/t/when-is-denormalizing-product-data-worth-the-sync-pain/680153)

<div class="topic-metadata">

**Author:** [@BobaMilk](https://forum.kirupa.com/u/BobaMilk)\
**Replies:** 2\
**Last updated:** [April 7, 2026, 7:00pm UTC](https://forum.kirupa.com/t/when-is-denormalizing-product-data-worth-the-sync-pain/680153 "2026-04-07T19:00:11Z")

</div>

Hey everyone, I’m working on a small product catalog and trying to decide if I should keep product info copied into carts and orders, or always read the latest product record when I need it. I like denormalizing because…

---

## [Why does this interval merge leave overlaps behind?](https://forum.kirupa.com/t/why-does-this-interval-merge-leave-overlaps-behind/680135)

<div class="topic-metadata">

**Author:** [@Quelly](https://forum.kirupa.com/u/Quelly)\
**Replies:** 5\
**Last updated:** [April 7, 2026, 6:42pm UTC](https://forum.kirupa.com/t/why-does-this-interval-merge-leave-overlaps-behind/680135 "2026-04-07T18:42:08Z")

</div>

Hey everyone, I’m working on a small scheduling tool and trying to merge overlapping time ranges before I render them. It mostly works, but in a few cases I still end up with overlaps, which means I either double-book a …

---

## [Why does this LRU cache evict the wrong key after a get?](https://forum.kirupa.com/t/why-does-this-lru-cache-evict-the-wrong-key-after-a-get/680151)

<div class="topic-metadata">

**Author:** [@MechaPrime](https://forum.kirupa.com/u/MechaPrime)\
**Replies:** 2\
**Last updated:** [April 7, 2026, 5:56pm UTC](https://forum.kirupa.com/t/why-does-this-lru-cache-evict-the-wrong-key-after-a-get/680151 "2026-04-07T17:56:08Z")

</div>

Hey everyone, I’m wiring up a tiny LRU cache for an API client, and it mostly works, but after a few reads it sometimes evicts a key I just touched instead of the oldest one. I was trying to keep it simple with Map inser…

---

## [Why does this debounce helper still fire twice sometimes?](https://forum.kirupa.com/t/why-does-this-debounce-helper-still-fire-twice-sometimes/680134)

<div class="topic-metadata">

**Author:** [@sarah\_connor](https://forum.kirupa.com/u/sarah_connor)\
**Replies:** 2\
**Last updated:** [April 7, 2026, 5:00pm UTC](https://forum.kirupa.com/t/why-does-this-debounce-helper-still-fire-twice-sometimes/680134 "2026-04-07T17:00:11Z")

</div>

Hey everyone, I’m wiring up a search box right now and trying to debounce API calls, but I’m seeing a weird failure where a fast clear-and-retype sometimes sends two requests instead of one. I want to keep the helper tin…

---

## [Why does this topological sort say there's a cycle when there isn't?](https://forum.kirupa.com/t/why-does-this-topological-sort-say-theres-a-cycle-when-there-isnt/680160)

<div class="topic-metadata">

**Author:** [@sora](https://forum.kirupa.com/u/sora)\
**Replies:** 2\
**Last updated:** [April 7, 2026, 4:42pm UTC](https://forum.kirupa.com/t/why-does-this-topological-sort-say-theres-a-cycle-when-there-isnt/680160 "2026-04-07T16:42:08Z")

</div>

Hey everyone, I’m wiring up a small build-order helper for plugin loading, and I’m trying to keep it simple with Kahn’s algorithm instead of a DFS version because I want clearer failure output when there really is a cycl…

---

## [Why does this binary search get stuck near the end?](https://forum.kirupa.com/t/why-does-this-binary-search-get-stuck-near-the-end/680129)

<div class="topic-metadata">

**Author:** [@sora](https://forum.kirupa.com/u/sora)\
**Replies:** 3\
**Last updated:** [April 7, 2026, 4:28pm UTC](https://forum.kirupa.com/t/why-does-this-binary-search-get-stuck-near-the-end/680129 "2026-04-07T16:28:28Z")

</div>

Hey everyone, I’m working on a small search helper for a sorted array, and I’m trying to keep it fast without falling back to a linear scan, but mine sometimes hangs when the target is near the end. function findIndex(a…

---

## [Why does this pagination helper skip an item between pages?](https://forum.kirupa.com/t/why-does-this-pagination-helper-skip-an-item-between-pages/680158)

<div class="topic-metadata">

**Author:** [@Yoshiii](https://forum.kirupa.com/u/Yoshiii)\
**Replies:** 1\
**Last updated:** [April 7, 2026, 3:35pm UTC](https://forum.kirupa.com/t/why-does-this-pagination-helper-skip-an-item-between-pages/680158 "2026-04-07T15:35:31Z")

</div>

Hey folks, I’m wiring up a tiny client-side pagination helper for a search results panel, and I’m trying to keep it simple without duplicating items or dropping one when the page size changes. function getPage(items, pa…

---

## [How do you know when feature flags are creating more risk than safety?](https://forum.kirupa.com/t/how-do-you-know-when-feature-flags-are-creating-more-risk-than-safety/680155)

<div class="topic-metadata">

**Author:** [@WaffleFries](https://forum.kirupa.com/u/WaffleFries)\
**Replies:** 1\
**Last updated:** [April 7, 2026, 3:00pm UTC](https://forum.kirupa.com/t/how-do-you-know-when-feature-flags-are-creating-more-risk-than-safety/680155 "2026-04-07T15:00:17Z")

</div>

Hey folks, I’m working on a product rollout right now and leaning pretty hard on feature flags so we can ship in smaller pieces without blowing up the main flow. It feels safer in the moment, but the tradeoff is we’re st…

---

## [When does idempotency stop helping and start hiding product bugs?](https://forum.kirupa.com/t/when-does-idempotency-stop-helping-and-start-hiding-product-bugs/680140)

<div class="topic-metadata">

**Author:** [@sora](https://forum.kirupa.com/u/sora)\
**Replies:** 2\
**Last updated:** [April 7, 2026, 10:42am UTC](https://forum.kirupa.com/t/when-does-idempotency-stop-helping-and-start-hiding-product-bugs/680140 "2026-04-07T10:42:08Z")

</div>

Hey everyone, I’m working on a checkout flow right now where we retry failed actions and lean on idempotency keys so users don’t get double charged when the network gets weird. The part I’m stuck on is that this also se…

---

## [Why does this DFS island counter miss cells on some grids?](https://forum.kirupa.com/t/why-does-this-dfs-island-counter-miss-cells-on-some-grids/680147)

<div class="topic-metadata">

**Author:** [@Ellen1979](https://forum.kirupa.com/u/Ellen1979)\
**Replies:** 2\
**Last updated:** [April 7, 2026, 10:35am UTC](https://forum.kirupa.com/t/why-does-this-dfs-island-counter-miss-cells-on-some-grids/680147 "2026-04-07T10:35:11Z")

</div>

Hey everyone, I’m working on a quick grid traversal helper in JavaScript for a practice problem, and I’m trying to keep it in-place so I don’t burn extra memory on a visited set, but on a few test cases it undercounts is…

---

## [When does event sourcing become more trouble than it saves?](https://forum.kirupa.com/t/when-does-event-sourcing-become-more-trouble-than-it-saves/680145)

<div class="topic-metadata">

**Author:** [@Baymax](https://forum.kirupa.com/u/Baymax)\
**Replies:** 1\
**Last updated:** [April 7, 2026, 9:21am UTC](https://forum.kirupa.com/t/when-does-event-sourcing-become-more-trouble-than-it-saves/680145 "2026-04-07T09:21:15Z")

</div>

Hey everyone, I’m working on a small internal app that started simple, but now we need audit history, undo support, and a few derived views that don’t always agree when updates arrive out of order. I’m trying to decide w…

---

## [Why is my optimistic cart update rolling back the wrong item?](https://forum.kirupa.com/t/why-is-my-optimistic-cart-update-rolling-back-the-wrong-item/680125)

<div class="topic-metadata">

**Author:** [@Ellen1979](https://forum.kirupa.com/u/Ellen1979)\
**Replies:** 2\
**Last updated:** [April 7, 2026, 8:42am UTC](https://forum.kirupa.com/t/why-is-my-optimistic-cart-update-rolling-back-the-wrong-item/680125 "2026-04-07T08:42:35Z")

</div>

Hey everyone, I’m wiring up a cart UI and trying to keep it snappy with optimistic updates, but when two quantity changes happen fast the rollback sometimes hits the newer value instead of the failed one. let cart = \[{ …

---

## [Why does this quickselect sometimes return the wrong kth value?](https://forum.kirupa.com/t/why-does-this-quickselect-sometimes-return-the-wrong-kth-value/680143)

<div class="topic-metadata">

**Author:** [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Replies:** 1\
**Last updated:** [April 7, 2026, 8:21am UTC](https://forum.kirupa.com/t/why-does-this-quickselect-sometimes-return-the-wrong-kth-value/680143 "2026-04-07T08:21:30Z")

</div>

Hey everyone, I’m wiring up a leaderboard helper and trying to avoid a full sort because the list can get pretty big, but my quickselect version occasionally returns the wrong item after a few swaps and that makes me ner…

---

## [Why does this heap-based merge skip some values?](https://forum.kirupa.com/t/why-does-this-heap-based-merge-skip-some-values/680131)

<div class="topic-metadata">

**Author:** [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Replies:** 1\
**Last updated:** [April 7, 2026, 4:21am UTC](https://forum.kirupa.com/t/why-does-this-heap-based-merge-skip-some-values/680131 "2026-04-07T04:21:28Z")

</div>

Hey everyone, I’m working on a small utility to merge several sorted arrays, and I’m using a min-heap so I don’t have to flatten everything first. It mostly works, but on duplicate values I sometimes lose items, which is…

---

## [Why is this topological sort saying there's a cycle when there isn't?](https://forum.kirupa.com/t/why-is-this-topological-sort-saying-theres-a-cycle-when-there-isnt/680127)

<div class="topic-metadata">

**Author:** [@WaffleFries](https://forum.kirupa.com/u/WaffleFries)\
**Replies:** 1\
**Last updated:** [April 7, 2026, 2:07am UTC](https://forum.kirupa.com/t/why-is-this-topological-sort-saying-theres-a-cycle-when-there-isnt/680127 "2026-04-07T02:07:37Z")

</div>

Hey folks, I’m wiring up a small task runner and trying to topologically sort job dependencies before execution, but this version keeps flagging a cycle on a graph that should be valid. I wanted something quick and simpl…

---

## [When does analytics instrumentation start distorting the product itself?](https://forum.kirupa.com/t/when-does-analytics-instrumentation-start-distorting-the-product-itself/680123)

<div class="topic-metadata">

**Author:** [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Replies:** 1\
**Last updated:** [April 7, 2026, 12:14am UTC](https://forum.kirupa.com/t/when-does-analytics-instrumentation-start-distorting-the-product-itself/680123 "2026-04-07T00:14:14Z")

</div>

Hey everyone, I’m working on a product flow redesign and trying to add more analytics so we can see where people drop off without flying blind. The part I’m stuck on is that every new event seems useful in isolation, bu…

---

## [Why does this rate limiter block requests longer than the window?](https://forum.kirupa.com/t/why-does-this-rate-limiter-block-requests-longer-than-the-window/680121)

<div class="topic-metadata">

**Author:** [@Quelly](https://forum.kirupa.com/u/Quelly)\
**Replies:** 1\
**Last updated:** [April 6, 2026, 11:42pm UTC](https://forum.kirupa.com/t/why-does-this-rate-limiter-block-requests-longer-than-the-window/680121 "2026-04-06T23:42:29Z")

</div>

Hey everyone, I’m wiring up a simple per-user rate limiter for a small API and trying to keep it cheap in memory, but right now it feels too strict after a burst and users stay blocked longer than I expect. class RateLi…

---

## [Why does this LRU cache evict the wrong key after a get?](https://forum.kirupa.com/t/why-does-this-lru-cache-evict-the-wrong-key-after-a-get/680119)

<div class="topic-metadata">

**Author:** [@MechaPrime](https://forum.kirupa.com/u/MechaPrime)\
**Replies:** 1\
**Last updated:** [April 6, 2026, 10:07pm UTC](https://forum.kirupa.com/t/why-does-this-lru-cache-evict-the-wrong-key-after-a-get/680119 "2026-04-06T22:07:27Z")

</div>

Hey everyone, I’m working on a small LRU cache for an API client, and I’m trying to keep it simple with a Map so reads stay fast. The weird part is that after I read a key, the next insert sometimes evicts that same key …

---

## [Why does this Dijkstra implementation lock in the wrong shortest path?](https://forum.kirupa.com/t/why-does-this-dijkstra-implementation-lock-in-the-wrong-shortest-path/680117)

<div class="topic-metadata">

**Author:** [@ArthurDent](https://forum.kirupa.com/u/ArthurDent)\
**Replies:** 2\
**Last updated:** [April 6, 2026, 10:00pm UTC](https://forum.kirupa.com/t/why-does-this-dijkstra-implementation-lock-in-the-wrong-shortest-path/680117 "2026-04-06T22:00:15Z")

</div>

Hey everyone, I’m wiring up a route finder for a small map tool, and my Dijkstra code mostly works until there are multiple entries for the same node in the heap. I skipped a decrease-key setup because life is short, but…

---

## [When does denormalizing product data stop paying off?](https://forum.kirupa.com/t/when-does-denormalizing-product-data-stop-paying-off/680113)

<div class="topic-metadata">

**Author:** [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Replies:** 2\
**Last updated:** [April 6, 2026, 9:21pm UTC](https://forum.kirupa.com/t/when-does-denormalizing-product-data-stop-paying-off/680113 "2026-04-06T21:21:13Z")

</div>

Hey everyone, I’m working on a catalog-heavy app and trying to decide how far to denormalize product data across search, listing, and recommendation paths. Reads get much simpler when each surface owns its own copy, but …

---

## [How to probe latent patterns in language models?](https://forum.kirupa.com/t/how-to-probe-latent-patterns-in-language-models/680118)

<div class="topic-metadata">

**Author:** [@sora](https://forum.kirupa.com/u/sora)\
**Replies:** 1\
**Last updated:** [April 6, 2026, 9:07pm UTC](https://forum.kirupa.com/t/how-to-probe-latent-patterns-in-language-models/680118 "2026-04-06T21:07:13Z")

</div>

Sean Trifero sketches a way of probing LLMs sideways instead of just asking better direct. Sora :slightly\_smiling\_face:

---

## [When does a feature flag system become worse than just shipping slower?](https://forum.kirupa.com/t/when-does-a-feature-flag-system-become-worse-than-just-shipping-slower/680107)

<div class="topic-metadata">

**Author:** [@ArthurDent](https://forum.kirupa.com/u/ArthurDent)\
**Replies:** 2\
**Last updated:** [April 6, 2026, 8:49pm UTC](https://forum.kirupa.com/t/when-does-a-feature-flag-system-become-worse-than-just-shipping-slower/680107 "2026-04-06T20:49:07Z")

</div>

Hey everyone, I’m working on a product with more and more feature flags, and it started as a sane way to reduce rollout risk but now every release feels like we’re dragging around old branches and weird edge cases. The t…

[Previous page](https://forum.kirupa.com/c/programming/41.md?page=13)

[Next page](https://forum.kirupa.com/c/programming/41.md?page=15)
