Skip to content

Commit f7a191d

Browse files
committed
prepending to lists is efficient
appending to a list also requires copying, unless I'm much mistaken.
1 parent b1c1a20 commit f7a191d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/vector.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ list (indexing to position N requires N pointer dereferences).
136136
By contract, vectors are stored in a packed format in memory, meaning indexing
137137
is an O(1) operation, and the memory overhead per additional item in the vector
138138
is much smaller (depending on the type of vector, which we'll cover in a
139-
moment). However, compared to lists, appending an item to a vector is
139+
moment). However, compared to lists, prepending an item to a vector is
140140
relatively expensive: it requires creating a new buffer in memory, copying the
141141
old values, and then adding the new value.
142142

0 commit comments

Comments
 (0)