diff --git a/v/related.v b/v/related.v index 78bf023e..46a16e3c 100644 --- a/v/related.v +++ b/v/related.v @@ -39,10 +39,12 @@ fn main() { } mut all_related_posts := []RelatedPosts{cap: posts.len} + mut tagged_post_count := []int{len: posts.len} for i, post in posts { - // slower when preallocated - mut tagged_post_count := []int{len: posts.len, cap: posts.len} + for j in 0 .. tagged_post_count.len { + tagged_post_count[j] = 0 + } for tag in post.tags { for post_index in tag_map[tag] {