SpiceGuid has quit [Quit: ChatZilla 0.9.92 [SeaMonkey 2.46/20161213183751]]
jbrown has quit [Ping timeout: 252 seconds]
nullifidian has quit [Read error: Connection reset by peer]
nullifidian has joined #ocaml
Associat0r_ has quit [Read error: Connection reset by peer]
snhmib has quit [Quit: WeeChat 1.9.1]
shinnya has joined #ocaml
mfp has quit [Ping timeout: 260 seconds]
jao has quit [Ping timeout: 260 seconds]
enterprisey has joined #ocaml
nullifidian has quit [Read error: Connection reset by peer]
nullifidian_ has joined #ocaml
nullifidian_ has quit [Read error: Connection reset by peer]
nullifidian__ has joined #ocaml
pierpa has quit [Quit: Page closed]
nullifidian__ has quit [Read error: Connection reset by peer]
nullifidian__ has joined #ocaml
zmt00 has quit [Read error: Connection reset by peer]
zmt00 has joined #ocaml
zmt00 has quit [Remote host closed the connection]
zmt00 has joined #ocaml
zmt00 has quit [Remote host closed the connection]
zmt00 has joined #ocaml
ziyourenxiang has quit [Ping timeout: 248 seconds]
Soni has quit [Ping timeout: 240 seconds]
alexelcu has quit [Remote host closed the connection]
alexelcu has joined #ocaml
bombastus has quit [Remote host closed the connection]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
govg has joined #ocaml
samrat_ has joined #ocaml
_whitelogger has joined #ocaml
samrat_ has quit [Ping timeout: 240 seconds]
ziyourenxiang has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
lgd has quit [Remote host closed the connection]
lgd_ has joined #ocaml
infinity0_ has joined #ocaml
infinity0_ has quit [Changing host]
infinity0_ has joined #ocaml
infinity0 has quit [Ping timeout: 260 seconds]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
FreeBirdLjj has joined #ocaml
zmt00 has quit [Quit: Leaving]
samrat_ has joined #ocaml
slash^ has joined #ocaml
enterprisey has quit [Remote host closed the connection]
ziyourenxiang has quit [Ping timeout: 240 seconds]
enterprisey has joined #ocaml
cbot has quit [Quit: Leaving]
Simn has joined #ocaml
enterprisey has quit [Remote host closed the connection]
SomeDamnBody has joined #ocaml
leah2 has quit [Ping timeout: 240 seconds]
<SomeDamnBody>
Does anybody know how much time or how expensive to call out to C code in ocaml?
cyraxjoe has quit [K-Lined]
cyraxjoe has joined #ocaml
leah2 has joined #ocaml
argent_smith has joined #ocaml
mk9 has joined #ocaml
mfp has joined #ocaml
mnemem_ has quit [Ping timeout: 258 seconds]
<flux>
somedamnbody, you could benchmark it, you know.. ;-)
<flux>
my understanding is "not very expensive"; even less so if the external function is marked as "noalloc"
<SomeDamnBody>
flux: Yeah. Well right now I think that calls out to C are a substantial cost. But I don't know why. I think it has to do with either the wrapping function or the trip from the ocaml runtime to the c++ code
<flux>
and perhaps more so if the external function releases the ocaml gc lock; I assume this uses a mutex
<SomeDamnBody>
flux: it's certainly not noalloc
snhmib has joined #ocaml
<flux>
somedamnbody, soo I did a benchmark
<flux>
an empty C function taking unit argument is 31.56 ns for ocamlc and 6.02 ns for ocamlopt
<SomeDamnBody>
I found the issue of my error was a large complexity case. Searching for something in an array.
jonasen has joined #ocaml
<flux>
somedamnbody, no problem. now I know the number as well :)
mk9 has quit [Quit: mk9]
<flux>
ah, should try the no-alloc and gc lock release cases as well
zolk3ri has joined #ocaml
<def`>
foo_nogc_noalloc (4.65 ns) is 24.9% faster than foo_gc_onearg (6.20 ns)
samrat_ has quit [Ping timeout: 248 seconds]
ziyourenxiang has joined #ocaml
mk9 has joined #ocaml
<def`>
foo_threadsafe_noalloc (14.86 ns) which is 8.7% faster than foo_threadsafe (16.27 ns)
mk9 has quit [Client Quit]
<def`>
so, with these measures, noalloc is 25% faster, locking/unlocking is 240% slower
kakadu has joined #ocaml
<def`>
hmm, and that was with the single threaded runtime. With pthread runtime it is 1000% slower (67ns)
arj has joined #ocaml
snhmib has quit [Ping timeout: 255 seconds]
luukAntwerp has quit [Ping timeout: 252 seconds]
<flux>
hmm, I wonder how I'm not getting any significant difference with any of those cases..
kakadu_ has joined #ocaml
<def`>
though the benchmark has a significant overhead, if I make 1000 calls to the C function, and benchmark that loop, I get 1.6ns per no-alloc call
kakadu has quit [Ping timeout: 260 seconds]
<def`>
benchmarking "ignore" gives 2.8ns per call, subtracting ignore duration from foo_noalloc duration gives back 1.6ns per call
<def`>
so it is more relevant to compare values if you use "ignore" as a baseline
<flux>
seems the package hasn't been updated since 2013. would be nice if that would be built in.
<def`>
:), at the same time, you shouldn't draw to much conclusions from a call that does (almost) nothing
<def`>
the results are highly sensitive to noise and hardware doing magic
<flux>
well isn't that the point of bench, evaluate it enough times to understand how much noise there is? though I guess it doesn't work great with these kind of super-micro benchmarks
nullifidian__ is now known as nullifidian
kakadu_ has quit []
fraggle_ has quit [Remote host closed the connection]
luukAntwerp has joined #ocaml
<flux>
soo, has anyone compared ocaml-format aginst ocpindent? is there a functional difference between them?
<Drup>
flux: one indent, the other formats, that's not really the same thing
<flux>
ah, so ocaml-format does complete reformatting then?
Soni has joined #ocaml
<zolk3ri>
flux: can I have a link to ocaml-format please?