Skip to content

Commit e803d78

Browse files
authored
Documentation: Mention Vararg{Any, N} in the "Performance Tips" section of the manual (#34796)
1 parent 3bcedb2 commit e803d78

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

doc/src/manual/performance-tips.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,11 @@ but this will:
534534
g_vararg(x::Vararg{Int, N}) where {N} = tuple(x...)
535535
```
536536

537+
One only needs to introduce a single type parameter to force specialization, even if the other types are unconstrained. For example, this will also specialize, and is useful when the arguments are not all of the same type:
538+
```julia
539+
h_vararg(x::Vararg{Any, N}) where {N} = tuple(x...)
540+
```
541+
537542
Note that [`@code_typed`](@ref) and friends will always show you specialized code, even if Julia
538543
would not normally specialize that method call. You need to check the
539544
[method internals](@ref ast-lowered-method) if you want to see whether specializations are generated

0 commit comments

Comments
 (0)