Comments (10)
jnr-posix suggests I'm correct, so I'm not sure why I'm seeing almost no performance impact. I guess some of the calls I'm making are already relatively slow, and the errno handling doesn't really matter?
from jnr-ffi.
Can you provide a benchmark that shows no perf improvement or negative impact? I believe in #80 the options and annotations are being combined properly, but it's possible that some lower level is not honoring the result.
from jnr-ffi.
FWIW, I was able to see a benefit from IgnoreError only in the most trivial cases, like getpid
which does practically no processing at the C level. The error saving is not particularly slow and ultimately boils down to one memory access and one thread-local variable assignment.
from jnr-ffi.
Sure thing! I'm using this from Clojure though, so I'm guessing you may want a different, Java-level benchmark :) The stuff I'm doing is definitely a lot "bigger" than getpid. The fastest thing I'm doing is secretbox crypto on a pre-allocated buffer, for which the mean execution time is 3.775396 ยตs. (I'm working on getting the files off my benchmark box now.)
from jnr-ffi.
Crud, I have to run the before-bench one more time. Bear with me :)
from jnr-ffi.
As long as the Clojure code isn't wiping out any gains from IgnoreError, it's fine. I'm a polyglot, I can deal with it?
I thought I might have saved the Java getpid benchmarks I wrote for my JNR talk some years ago, but I can't seem to find them.
from jnr-ffi.
Benchmark output: https://gist.github.com/lvh/cc2e0d5a8eecd6c631e11c39134faf5a
You can run the benchmarks yourself by cloning lvh/caesium and running (assuming you have leiningen):
lein with-profile +benchmarks test
There is one expected test failure (only for the benchmarks): that's a bug in Clojure's reflector. This tests a lot of stuff you might not care about, like e.g. reflection vs type hinted call performance, but that's the entire result :)
from jnr-ffi.
Oh, right; my apologies, I forgot you're the JRuby guy. I guess I just wanted to be as acommodating as possible since I'm getting free support :D
from jnr-ffi.
This output is very confusing for me to read...perhaps you can pare it down to the simplest case?
from jnr-ffi.
Sorry; this has fallen off my radar, but I've worked to present the data a bit better, and now using the IgnoreError LibraryOption. I'm calling (.option my-loader LibraryOption/IgnoreError true)
; I'm assuming that's how you use it (if not, that gives me a good idea about my std dev ;-))
The results are summarized in this Google Spreadsheet:
from jnr-ffi.
Related Issues (20)
- UnsatisfiedLinkError when loading 3 dependent libraries HOT 11
- Unsatisfied link when used in conjunction with jnr-posix HOT 5
- Investigate failing Pointer Boolean tests on Darwin (macOS)
- LibraryLoader.search() path not taken into consideration unless also in LD_LIBRARY_PATH HOT 3
- What's the mapping Java type of C type FILE *?
- [feature request] HOT 1
- Erorr : jnr.ffi.provider.jffi.Provider
- Native Object filling "not working"
- Native C calling Java method HOT 1
- Cannot pass a struct to 'c' function by value
- Multi-dimensional arrays as struct members HOT 1
- Load the static link library HOT 1
- Release new version of jnr-ffi HOT 1
- Why use JNR over JNA HOT 1
- support convert pointer to struct
- String parameter of a callback function gets messed when passed from DLL (Rust) to Java HOT 2
- Android and bytecode
- document build procedures
- JVM crash invoking some SDL Library function
- Bad dates in jnr/jnr-ffi commits HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jnr-ffi.