Skip to content

Commit c3429c9

Browse files
authored
docs(useMemoize): add performance warnings (#5077)
1 parent dd31de6 commit c3429c9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/core/useMemoize/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ await getUser.load(1) // Will also update user1
5353
The key for caching is determined by the arguments given to the function and will be serialized by default with `JSON.stringify`.
5454
This will allow equal objects to receive the same cache key. In case you want to customize the key you can pass `getKey`
5555

56+
::: warning Performance Consideration
57+
Using `JSON.stringify` as the default key generator can be **slow for large or complex objects**. For better performance with complex arguments, it's highly recommended to provide a custom `getKey` function that generates keys based on primitive values or unique identifiers.
58+
:::
59+
60+
#### Basic Example
61+
5662
```ts
5763
import { useMemoize } from '@vueuse/core'
5864
// ---cut---

0 commit comments

Comments
 (0)