Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #3852

Re: JNA performance

From Lew <noone@lewscanon.com>
Newsgroups comp.lang.java.programmer
Subject Re: JNA performance
Date 2011-05-09 09:57 -0400
Organization albasani.net
Message-ID <iq8rt3$lbn$1@news.albasani.net> (permalink)
References <tqmdnUiqqro_tlvQnZ2dnUVZ_tmdnZ2d@westnet.com.au> <iq60hd$9i5$1@news.albasani.net> <jcjes6p6n24c0tksn6ivq6is7i8q30rd26@4ax.com> <iq8n3d$9uv$2@news.albasani.net> <v7rfs690sevbb487qlgjd3rmqk89rm51li@4ax.com>

Show all headers | View raw


On 05/09/2011 09:34 AM, Roedy Green wrote:
> On Mon, 09 May 2011 08:36:00 -0400, Lew<noone@lewscanon.com>  wrote,
> quoted or indirectly quoted someone who said :
>
>> So you have access to his performance test results to know where his
>> bottleneck is?  Amazing.
>
> In one sense yes.  All JNI programs that are pure glue have the same
> problem. There is nothing else too them but the glue.

You raise a good point, several really.

While it is true that "premature optimization is the root of all evil", as 
Knuth famously pronounced, there is optimization that is not premature.

Roedy's advice is sound because he addresses a well-known source of 
bottlenecks generally, the communication across the boundary between the JVM 
and native code.  It's entirely appropriate to consider the impact of such a 
predictable architectural constraint.

OTOH, appropriate responses to this constraint are very specific to the 
particulars of the application.  If the Java program initiates all contact 
with native logic or data, for example, it might have a lot more control over 
the frequency of contact and the granularity of activity per call.  If contact 
is rare, or only flows from the JVM to the native world without need for 
reply, then the JNI impact might be nil.  No "optimization" needed.

For use cases involving tight communication between native logic and Java 
logic, the pendulum swings the other way.  You'll need to be hyper-aware of 
the issues around the link, not only for performance but for resource disposal 
and many other matters.  Thinking about performance during your architecture 
moments is a good thing to do in this context.

For a great many applications, you should consider performance measurement. 
This does not replace the kind of architectural planning or up-front wisdom 
that Roedy suggests.  It supplements your overall quality strategy.  Profiles 
and baseline throughput measurements help you understand which theoretical 
bottlenecks actually present practical problems, and contrariwise.  They also 
help you decide which ones of the real bottlenecks are worth fixing.  Some 
might be outside program control, or already at optimum albeit disappointing 
performance.  Some might be a little slower than you really could do, but not 
worth the expense or effort to improve slightly.

So do follow Roedy's advice - which I'll paraphrase as "consider the impact of 
the slow communication gate between JVM and native code" - and welcome the 
knowledge he gave, that that gate is a slow one.

-- 
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

JNA performance "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-05-08 15:35 +1000
  Re: JNA performance Knute Johnson <nospam@knutejohnson.com> - 2011-05-07 22:48 -0700
    Re: JNA performance "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-05-08 16:03 +1000
      Re: JNA performance Knute Johnson <nospam@knutejohnson.com> - 2011-05-08 09:54 -0700
    Re: JNA performance Steve Sobol <sjsobol@JustThe.net> - 2011-05-08 13:26 -0700
      Re: JNA performance "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-05-09 08:44 +1000
        Re: JNA performance Jeff Higgins <jeff@invalid.invalid> - 2011-05-08 21:17 -0400
        Re: JNA performance Jeff Higgins <jeff@invalid.invalid> - 2011-05-08 21:20 -0400
          Re: JNA performance Jeff Higgins <jeff@invalid.invalid> - 2011-05-08 21:24 -0400
            Re: JNA performance "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-05-09 13:39 +1000
              Re: JNA performance Steve Sobol <sjsobol@JustThe.net> - 2011-05-08 21:54 -0700
                Re: JNA performance "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-05-09 15:47 +1000
                Re: JNA performance Steve Sobol <sjsobol@JustThe.net> - 2011-05-08 23:26 -0700
                Re: JNA performance "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-05-09 17:07 +1000
                Re: JNA performance Steve Sobol <sjsobol@JustThe.net> - 2011-05-10 12:44 -0700
        Re: JNA performance Tom Anderson <twic@urchin.earth.li> - 2011-05-09 18:21 +0100
          Re: JNA performance Steve Sobol <sjsobol@JustThe.net> - 2011-05-09 13:05 -0700
            Re: JNA performance Tom Anderson <twic@urchin.earth.li> - 2011-05-09 21:09 +0100
              Re: JNA performance Steve Sobol <sjsobol@JustThe.net> - 2011-05-09 17:58 -0700
  Re: JNA performance Roedy Green <see_website@mindprod.com.invalid> - 2011-05-07 23:25 -0700
    Re: JNA performance "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-05-08 16:32 +1000
    Re: JNA performance Steve Sobol <sjsobol@JustThe.net> - 2011-05-08 13:27 -0700
  Re: JNA performance Lew <noone@lewscanon.com> - 2011-05-08 07:58 -0400
    Re: JNA performance Roedy Green <see_website@mindprod.com.invalid> - 2011-05-08 19:17 -0700
      Re: JNA performance Lew <noone@lewscanon.com> - 2011-05-09 08:36 -0400
        Re: JNA performance Roedy Green <see_website@mindprod.com.invalid> - 2011-05-09 06:34 -0700
          Re: JNA performance Lew <noone@lewscanon.com> - 2011-05-09 09:57 -0400
  O/T: Tag lines, or sigs (Was: JNA performance) Lew <noone@lewscanon.com> - 2011-05-08 08:02 -0400
    Re: O/T: Tag lines, or sigs (Was: JNA performance) Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-05-08 11:24 -0300
      Re: O/T: Tag lines, or sigs (Was: JNA performance) Lew <noone@lewscanon.com> - 2011-05-08 12:35 -0400
        Re: O/T: Tag lines, or sigs (Was: JNA performance) Knute Johnson <nospam@knutejohnson.com> - 2011-05-08 09:54 -0700
      Re: Tag lines, or sigs (Was: JNA performance) "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-05-09 03:37 +1000
      Re: O/T: Tag lines, or sigs (Was: JNA performance) Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-09 15:50 +1200
        Re: O/T: Tag lines, or sigs (Was: JNA performance) Lew <noone@lewscanon.com> - 2011-05-09 08:36 -0400
    Re: O/T: Tag lines, or sigs (Was: JNA performance) "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-05-09 03:37 +1000
      Re: O/T: Tag lines, or sigs (Was: JNA performance) Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-05-08 19:55 +0200
        Re: O/T: Tag lines, or sigs (Was: JNA performance) Martin Gregorie <martin@address-in-sig.invalid> - 2011-05-08 19:30 +0000
          Re: O/T: Tag lines, or sigs (Was: JNA performance) Steve Sobol <sjsobol@JustThe.net> - 2011-05-08 13:28 -0700
  Re: JNA performance Jim Janney <jjanney@shell.xmission.com> - 2011-05-09 08:54 -0600

csiph-web