News for hackers. Stuff that matters.
Re:Comparing the C FFI overhead in various programming langu... by vortico on Saturday May 26, 2018 @11:26PM (#17165301)
I'd be interested in seeing Ruby-FFI, CPython, CFFI (Common Lisp) and C#'s DllImport.
Re:Comparing the C FFI overhead in various programming langu... by jlarocco on Sunday May 27, 2018 @03:05AM (#17165855)
I was curious about Common Lisp's CFFI also, so I tried it out. [1]

On my machine, the C version prints between 6855 and 6910.

Using SBCL (cffi-bench:run 2000000000) prints between 9185 and 9205.

Clisp is significantly slower, and (cffi-bench:run 200000000) is already at 55500, compared to ~100 in SBCL.

CCL crashes with a segmentation fault, and I'm still debugging.

Tomorrow I'll see about creating a build script and opening a pull request to the main repo.

[1] https://github.com/jl2/ffi-overhead/tree/master/common-lisp/...

EDIT: I recompiled the .so and C program with -O3, and it now prints between 4740-4780. SBCL using the -O3 library prints 7935 and 8935.

Re:Comparing the C FFI overhead in various programming langu... by nabla9 on Sunday May 27, 2018 @06:31AM (#17166328)
If we use the C performance ratio between the machines to adjust machine to machine comparisons. SBCL would be around 1600 in the original benchmark, between D and Java.
Re:Comparing the C FFI overhead in various programming langu... by calvin_ on Sunday May 27, 2018 @05:11PM (#17169130)
Re:Comparing the C FFI overhead in various programming langu... by scruple on Sunday May 27, 2018 @02:10PM (#17168209)
I built out a ruby-ffi test immediately upon seeing this. I want to put a little more effort in to it (I need to run some errands and spent all of 5 minutes on this), but... 2 samples/runs, 500M calls: 51050, 50853. No surprises there, really.

edit/ Ran this on my desktop (gaming rig) i7-4790k, 16GB RAM, gcc 7.3.1 20180406, Arch on Windows Subsystem for Linux. I have a machine closer in specs to the original authors that I'll test it against later today (hopefully).