I dreamed about a combination of #AdventOfCode and #mscroggs .
Day 10: Day 3 should actually run for 7 rounds, not 4.
Running for 7 rounds requires #memoization . Of course.
I dreamed about a combination of #AdventOfCode and #mscroggs .
Day 10: Day 3 should actually run for 7 rounds, not 4.
Running for 7 rounds requires #memoization . Of course.
The Useless “useCallback”, by @tkdodo.eu:
1. IntroductionIf you’ve taken an algorithms class, you have likely seen dynamic programming, specifically a technique called memoization. Memoization works to optimize recursive algorithms by caching the solutions to subproblems in a table, and when a subproblem is encountered, it queries the table instead of recomputing the solution. This gives us an exponential performance boost.
#commonLisp #programming #amop #mop #metaobjectProtocol #exercise #closette #learnToCode (my own experience) #oop
https://screwlisp.small-web.org/amop/eg1/
Today I simply share and solve (hopefully!) The Art of the Metaobject Protocol exercise 1.1
(the softball generic classes #memoization exercise from chapter 1)
I just added a lexical closure of hash tables.
@simoninireland wrote about the art of the metaobject protocol in his #lisp bibliography a year ago. https://simondobson.org/2024/07/23/the-art-of-the-metaobject-protocol/
Memoizing the Cache in Laravel, by @amitmerchant.bsky.social:
https://www.amitmerchant.com/memoizing-the-cache-in-laravel/
Between immutability and memoization, you might have to choose, by Rémy Hannequin
https://thoughtbot.com/blog/between-immutability-and-memoization-you-might-have-to-choose
Freezing objects, pre-computation, cache, #memoization.. which one you can use, when it's worthy?
I started implementing some explorations in #Haskell but I had to ditch `data-memocombinators` because #MicroHs doesn't properly support #RankNTypes yet. Instead I'm doing manual #memoization with #array :
```
import Data.Array
-- memoized function, looks up in array
f :: Int -> Int -> Int -> Int
f = \x y z -> if inRange fBounds (x, y, z) then fArray ! (x, y, z) else 0
-- real algorithm, recursive calls use memoized function
f' :: Int -> Int -> Int -> Int
f' 1 1 1 = 1
f' a b c = sum [ f (a - 1) b c, f a (b - 1), f a b (c - 1) ]
-- array, generated with real algorithm
fArray :: Array (Int, Int, Int) [Bool]
fArray = array fBounds [ (i, f' x y z) | i@(x, y, z)<- range fBounds ]
-- array bounds
fBounds :: ((Int, Int, Int), (Int, Int, Int))
fBounds = ((1, 1, 1), (limit, limit, limit))
-- can be as large as necessary for the real problem,
-- but going too big consumes too much memory
limit :: Int
limit = 45
```
[Перевод] React useCallback() — полное руководство
Всем привет! На связи Разобраться с useCallback() полностью
React. Обновление узлов и мемоизация
В процессе разработки современных веб-приложений производительность часто становится одним из ключевых аспектов, которые волнуют и разработчиков, и пользователей. Пользователи ожидают молниеносного отклика, а разработчики стремятся создать приложения, которые работают быстро и эффективно. Одним из мощных инструментов, позволяющих достигнуть высокой производительности в React-приложениях, является мемоизация. Мемоизация помогает значительно сократить количество вычислений и, соответственно, обновлений интерфейса, что положительно сказывается на общей скорости и отзывчивости приложения. В данной статье мы заглянем "под капот" движка React и увидем, как именно происходит обновление узлов. Параллельно рассмотрим и основные принципы мемоизации и её применение в различных типах компонентов.