Skip to content

Commit 103e6db

Browse files
committed
Make std.iter.Stream an inline type
Since this type just wraps a closure there's no need to heap allocate it. Changelog: performance
1 parent 8d01bfc commit 103e6db

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

std/src/std/iter.inko

+3-3
Original file line numberDiff line numberDiff line change
@@ -671,17 +671,17 @@ trait pub IntoIter[T] {
671671
# nums.next # => Option.Some(1)
672672
# }
673673
# ```
674-
type pub Stream[T] {
674+
type pub inline Stream[T] {
675675
let @func: fn -> Option[T]
676676

677677
# Returns a new iterator using the closure.
678-
fn pub static new(func: fn -> Option[T]) -> Stream[T] {
678+
fn pub inline static new(func: fn -> Option[T]) -> Stream[T] {
679679
Stream(func)
680680
}
681681
}
682682

683683
impl Iter[T] for Stream {
684-
fn pub mut next -> Option[T] {
684+
fn pub inline mut next -> Option[T] {
685685
@func.call
686686
}
687687
}

0 commit comments

Comments
 (0)