You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/sources/k6/next/javascript-api/k6-data/sharedarray.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ However, certain operations can negate these benefits by converting the `SharedA
54
54
55
55
### Avoid array methods that create new arrays
56
56
57
-
Methods like `.filter()` and `.map()` create new regular arrays when called on an already-created`SharedArray`, which removes the memory efficiency benefits.
57
+
Methods like `.filter()` and `.map()` create regular arrays when called on a`SharedArray`, which removes the memory efficiency benefits.
58
58
Instead, iterate over the `SharedArray` and process elements individually.
59
59
60
60
However, you can use `.filter()` or `.map()` inside the `SharedArray` constructor function, since that operation only happens once during initialization.
@@ -119,7 +119,7 @@ export default function () {
119
119
120
120
### Avoid marshalling the entire SharedArray
121
121
122
-
Marshalling or serializing a `SharedArray` (for example, with `JSON.stringify()`) converts it to a regular array representation, eliminating memory efficiency benefits.
122
+
When you marshal or serialize a `SharedArray` (for example, with `JSON.stringify()`), it converts to a regular array representation, which eliminates memory efficiency benefits.
123
123
Only marshal individual elements when needed.
124
124
125
125
**Don't:**
@@ -184,7 +184,7 @@ export default function () {
184
184
185
185
### Avoid returning SharedArray from setup()
186
186
187
-
Returning a `SharedArray` from the `setup()` function causes it to be marshalled, which removes its memory efficiency benefits.
187
+
When you return a `SharedArray` from the `setup()` function, k6 marshals it, which removes its memory efficiency benefits.
188
188
Keep `SharedArray` instances in the init context instead.
0 commit comments