RS
Size: a a a
RS
KT
struct Foo{N,T}
t :: NTuple{N,T}
end
using BenchmarkTools
@benchmark Foo($(1,2,3))
@benchmark Foo($(big(1),big(2),big(3)))KT
VG
KT
t = (big(1), big(2), big(3))
@benchmark Foo($t)
BenchmarkTools.Trial:
memory estimate: 16 bytes
allocs estimate: 1
--------------
minimum time: 4.524 ns (0.00% GC)
median time: 5.824 ns (0.00% GC)
mean time: 7.327 ns (1.73% GC)
maximum time: 516.912 ns (97.99% GC)
--------------
samples: 10000
evals/sample: 1000
KT
@code_native Foo(t)
.text
; ┌ @ REPL[2]:2 within `Foo'
pushq %rbx
subq $16, %rsp
movq %rsi, 8(%rsp)
movq %fs:0, %rdi
addq $-15712, %rdi # imm = 0xC2A0
movq (%rsi), %rbx
; │ @ REPL[2]:2 within `Foo' @ REPL[2]:2
movabsq $jl_gc_pool_alloc, %rax
movl $1400, %esi # imm = 0x578
movl $16, %edx
callq *%rax
movabsq $140263718658720, %rcx # imm = 0x7F91B12022A0
movq %rcx, -8(%rax)
movq %rbx, (%rax)
; │ @ REPL[2]:2 within `Foo'
addq $16, %rsp
popq %rbx
retq
; └
KT
@code_native Foo((1,2,3))
.text
; ┌ @ REPL[2]:2 within `Foo' @ REPL[2]:2
movq 16(%rdx), %rax
movq %rax, 16(%rdi)
vmovups (%rdx), %xmm0
vmovups %xmm0, (%rdi)
; │ @ REPL[2]:2 within `Foo'
movq %rdi, %rax
retq
nopw %cs:(%rax,%rax)
; └
ВФ
KT
ВФ
АО
АО
KT
big, а свои custom typesKT
ВФ
KT
ВФ
KT
KT
АО