Skip to content

Commit 64712b4

Browse files
authored
rephrase: "str is 2 pointers" -> "str costs 2 pointers"
1 parent cc2a29f commit 64712b4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/projects/container_image_dist_ref.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct ImgRef<'a> {
6363

6464
64 bytes is a bit much! Reading the [docs on `&str`](https://doc.rust-lang.org/std/primitive.str.html#representation) pointed out the problem.
6565

66-
Each `&str` is made of 2 pointers: a pointer to the underlying data and a pointer-sized length.
66+
Each `&str` costs 2 pointers' worth of memory: a pointer to the underlying data and a pointer-sized length.
6767
If each `&str` segment is pointing to the same underlying data, this means the `ImgRef` struct includes 3 unneeded pointers!
6868

6969
Representing each part of an image reference as a length of the source string led to some nice savings:

0 commit comments

Comments
 (0)