Skip to content

Commit c8ccd64

Browse files
authored
add benchmarks for ccall (#316)
1 parent 957625b commit c8ccd64

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

benchmark/benchmarks.jl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,16 @@ function counter()
5353
@do_thing(a = a + 1, 5_000)
5454
return a
5555
end
56-
SUITE["long function 5_000"] = @benchmarkable @interpret counter()
56+
SUITE["long function 5_000"] = @benchmarkable @interpret counter()
57+
58+
# Ccall
59+
function ccall_ptr(ptr, x, y)
60+
ccall(ptr, Int, (Int, Int), x, y)
61+
end
62+
const ptr = @cfunction(+, Int, (Int, Int))
63+
SUITE["ccall ptr"] = @benchmarkable @interpret ccall_ptr(ptr, 1, 5)
64+
65+
function powf(a, b)
66+
ccall(("powf", Base.Math.libm), Float32, (Float32,Float32), a, b)
67+
end
68+
SUITE["ccall library"] = @benchmarkable @interpret powf(2, 3)

0 commit comments

Comments
 (0)