Giter Club home page Giter Club logo

Comments (10)

lvh avatar lvh commented on September 13, 2024

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?

https://github.com/jnr/jnr-posix/blob/a9dc5fb8c62e75a96d94d562b88765f647ff2f20/src/main/java/jnr/posix/LibC.java#L54

from jnr-ffi.

headius avatar headius commented on September 13, 2024

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.

headius avatar headius commented on September 13, 2024

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.

lvh avatar lvh commented on September 13, 2024

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.

lvh avatar lvh commented on September 13, 2024

Crud, I have to run the before-bench one more time. Bear with me :)

from jnr-ffi.

headius avatar headius commented on September 13, 2024

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.

lvh avatar lvh commented on September 13, 2024

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.

lvh avatar lvh commented on September 13, 2024

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.

headius avatar headius commented on September 13, 2024

This output is very confusing for me to read...perhaps you can pare it down to the simplest case?

from jnr-ffi.

lvh avatar lvh commented on September 13, 2024

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:

https://docs.google.com/a/lvh.cc/spreadsheets/d/1bEqlUNp4ZXRjkN2X50st7lWiV47NlQGIJUgidm2WgBs/edit?usp=sharing

from jnr-ffi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.