Skip to content

Commit 0a86329

Browse files
Apply suggestions from code review
Co-authored-by: Heitor Tashiro Sergent <heitortsergent@gmail.com>
1 parent 14075d0 commit 0a86329

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/sources/k6/next/javascript-api/k6-data/sharedarray.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ However, certain operations can negate these benefits by converting the `SharedA
5454

5555
### Avoid array methods that create new arrays
5656

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.
5858
Instead, iterate over the `SharedArray` and process elements individually.
5959

6060
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 () {
119119

120120
### Avoid marshalling the entire SharedArray
121121

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.
123123
Only marshal individual elements when needed.
124124

125125
**Don't:**
@@ -184,7 +184,7 @@ export default function () {
184184

185185
### Avoid returning SharedArray from setup()
186186

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.
188188
Keep `SharedArray` instances in the init context instead.
189189

190190
**Don't:**

0 commit comments

Comments
 (0)