Simple interface vs. inline speed comparison with unexpected results

I posted this question also to the Hotspot internals section which was, may be, the wrong place.
Recently, I wrote a simple superficial test to inform myself about the potential penalty for calling methods through interfaces, generic interfaces, final classes vs. inlined code. The example consists of two interfaces
public interface A{
    public long doA( long a );
public interface B{
    public long doB( long b );
}an interface that extends both
public interface AB extends A, B {}and two final classes, one implementing AB and the other implementing A and B
final public class ABClass implements AB {
    final long c;     
    public ABClass( final long c ) { this.c = c; }
    @Override
    final public long doA( final long a ) {
        return a * a + c;
    @Override
    final public long doB( final long b ) {
        return b * b + c;
final public class APlusBClass implements A, B {
    final long c;     
    public APlusBClass( final long c ) { this.c = c; }
    @Override
    final public long doA( final long a ) {
        return a * a + c;
    @Override
    final public long doB( final long b ) {
        return b * b + c;
}I perform five tests, each looping over long i from 0 to 1000000000, summing up the return values of both methods called with i. The test is performed calling methods using the parameters AB, a generic Type implementing A & B, and the final classes directly in all possible combinations
final static private long finalAB( final ABClass ab, final long x ) {
    return ab.doA( x ) + ab.doB( x );
final static private long finalAPlusB( final APlusBClass ab, final long x ) {
    return ab.doA( x ) + ab.doB( x );
final static private long nonGeneric( final AB ab, final long x ) {
    return ab.doA( x ) + ab.doB( x );
final static private < T extends A & B >long generic( final T ab, final long x ) {
    return ab.doA( x ) + ab.doB( x );
}Furthermore, as a last test, the calls to doA( x ) + doB( x ) are explicitly inlined
x * x + c + x * x + c;All six tests are performed 10 times.
The test is here, including the sources:
[http://www.speedyshare.com/files/22401605/download/test.jar|http://www.speedyshare.com/files/22401605/download/test.jar]
java -jar test.jar
When running the test, I get two surprising results:
1. The first run is the fastest for all tests but the explicitly inlined test. All tests are approx. equally fast but the inlined version is slowest(?).
2. From the second run, all tests are about 1.5x slower, except the explicitly inlined which has constant speed in all runs and is now the fastest.
I would be very happy if somebody could highlight to me the rationale behind these effects.
Thank you very much in advance.

axtimwalde wrote:
Again, you're wrongly interpreting, I assume it would help to look at and understand the test?! It demonstrates nicely, that, in Java 6, there is no additional cost for calling methods through interface hierarchies vs. final classes which is very nice. With Java 5, this is not the case, which is also clearly demonstrated by this test. So?
Referring to nanoseconds makes no sense at all, what matters is the factor that separates two different execution speeds. There are applications, where it matters a lot if it is an order of magnitude slower or not, that may be the argument that separates great from trash. Name one application where your results would make the major functionality of the application an order of magnitude faster.
Consider also, that there are platforms that still lack support for Java > 5.I write high performance servers for a living. And I have been doing it for years. I have done it in C#, Java and C++. I have profiled applications in all of those languages in multiple problem domains.
And there was never a single case where call semantics impacted the speed of the application in anyway that was even measurable.

Similar Messages

  • Simple XMLTABLE query with unexpected results

    I have the following (simplified) query. I have formatted the XML for easy reading in this message but there is no whitespace in the actual query.
    Can anyone tell me why I am receiving no records returned. Expecting one record with the value of 'REJECT'
    Thanks in advance.
    select a.decision
        from XMLTABLE(xmlnamespaces('http://schemas.xmlsoap.org/soap/envelope/' as "soap"
                                  , 'urn:schemas-cybersource-com:transaction-data-1.28' as "c")
                   , '/soap:Envelope/soap:Body/c:ReplyMessage'
          PASSING xmltype.createxml('
    <?xml version="1.0" encoding="utf-8" ?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Header>
       <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
        <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-27593971">
         <wsu:Created>2009-06-15T17:49:02.870Z</wsu:Created>
        </wsu:Timestamp>
       </wsse:Security>
      </soap:Header>
      <soap:Body>
       <c:replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.28">
        <c:merchantReferenceCode>27-0</c:merchantReferenceCode>
        <c:requestID>2450881422960008402433</c:requestID>
        <c:decision>REJECT</c:decision>
        <c:reasonCode>520</c:reasonCode>
        <c:requestToken>Ahj77wSRCbmf6bYuaSwCIJsfFx1osBTY+LjrRekDpt6POYI0kyro9JLBWBORCbmf6bYuaSwCAAAALQX8</c:requestToken>
        <c:purchaseTotals>
         <c:currency>USD</c:currency>
        </c:purchaseTotals>
        <c:ccAuthReply>
         <c:reasonCode>520</c:reasonCode>
         <c:amount>99.50</c:amount>
         <c:authorizationCode>123456</c:authorizationCode>
         <c:avsCode>Y</c:avsCode>
         <c:avsCodeRaw>YYY</c:avsCodeRaw>
         <c:cvCode/>
         <c:cvCodeRaw/>
         <c:authorizedDateTime>2009-06-15T17:49:02Z</c:authorizedDateTime>
         <c:processorResponse>A</c:processorResponse>
        </c:ccAuthReply>
       </c:replyMessage>
      </soap:Body>
    </soap:Envelope>')
          COLUMNS
            decision varchar2(30) PATH '/c:ReplyMessage/c:decision') aScott

    i think that the problem was in
    '/c:replyMessage/c:decision' and not '/c:ReplyMessage/c:decision'
    and
    '/soap:Envelope/soap:Body/c:replyMessage' not '/soap:Envelope/soap:Body/c:ReplyMessage'
    try
    Bye
    Maurizio

  • Rollover buttons with unexpected results

    Hello Folks,
    I'm hoping someone can point me in the right direction with a
    problem I'm having with rollover buttons.
    I've used Fireworks to create five rollover buttons with
    round corners onto a single transparent canvas. I've exported the
    images as gif and then pasted the relevant code into Dreamweaver.
    I'm getting two results that are puzzling me.
    1. The images are not being displayed with transparent
    backgrounds, as you can see at this url:
    http://www.magicalwonders.com/rollover/index2.html
    The corners are showing which is not what I want. I notice that
    there are four types of gif than can be exported when making
    rollovers. So far, I've tried using Gif adaptive 256 and Gif
    Websnap 256 with no success.
    2. The second puzzle is that including the javascript code
    seems to have increased the top margin for the background of the
    page. If you compare the page before any code is added, you can see
    the difference:
    http://www.magicalwonders.com/rollover/index.html
    Hope someone can advise
    Many thanks,
    Myles

    Myles,
    Try exporting your menu images as png 8 files with index
    transparency.
    alex
    Magicalwonders wrote:
    > Just a quick update. I've corrected all the errors in
    the code and that has
    > fixed the margin problem.
    >
    http://www.magicalwonders.com/rollover/index3.html
    >
    > So now I just have the issue of rollover buttons with
    round corners. Not sure
    > what I'm doing wrong?
    >
    > Hope someone can help.
    >
    > Myles
    >

  • MDSSTR23 %NPV-5-FRAME_DISCARDED: %$VSAN 1%$ Frame with unexpected FC2 status 0xc received on interface ext2

    hello
    Customer reported these error messages on 2X Mds9124e
    reproducible every 28minutes, even if MDS system message and recovery
    say no action (below extract)
    how to fix this issue because syslog files and log files are full rapidly
    thanks in advance
    JYP
    Error Message     NPV-5-FRAME_DISCARDED: [chars]
    Explanation    NPV process discarded an FC2 frame.
    Recommended Action    No action is required.

    although we don't use vlan 1 we got the same message every 20 minutes on some interfaces
    %NPV-5-FRAME_DISCARDED: %$VSAN 998%$ Frame with unexpected FC2 status 0xc received
    I enabled some debug to find out senders source of these frame by using:
    debug npv errors vsan 999
    debug npv events vsan 999
    debug fc2 error vsan 999 interface fc2/2
    But the onyl additional info I got was:
    2012 Nov 29 09:34:27.335338 npv: npivp_fc2_msg_recv: Unknown fc2 status 12
    What debug I've to use to find out the source?

  • IS THERE ANY SIMPLE WAY TO RETURN SPEED PERFORMANCE TO FACTORY SPEED AFTER ABOUT 3 YEARS OF RELATIVELY STANDARD USE?

    Everyone is often so quick to bash all these 'cleaning' utilities but rarely give any solutions.
    There's a lot of critiques and endless lists of what NOT to do to avoid performance problems.
    My Powerbook is 3 years old. It runs like molasses... SLOW.
    I'm not a computer geek, but I'm smart and understand quite a bit more than a newbie.
    Do I need a degree in computer engineering to fix/speed up my mac?
    Yes, I know, the cleaning utilities suck. But is it really true of all of them?
    I'm not totally convinced because there seems to be such a huge market for them.
    Sure, there's a huge market for bottled water too, so maybe they are just useless/marketing crap, but I really want to return to my original speed performance quickly and can't seem to find out if it's possible with a utility.
    I'm not willing to sit down for 3 hours and study line by line b.s. about how to fix it.
    I have no problem if it's not fixable. I've always assumed operating systems outgrow their hardware's capacity to keep up, and sell my old one for a new one, no prob.
    I don't care, really, but again, I'm curious if there is any quick, easy, user-friendly utility or method that I can use to return the speed performance I had as recently as a year ago? (I'd be satisfied with that).
    Anyone willing to bite on that? Anyone willing to not critique, complain, tell me what NOT to do and actually know a solution?
    IS THERE ANY SIMPLE WAY TO RETURN SPEED PERFORMANCE BACK TO (OR CLOSE TO) ORIGINAL FACTORY SPEED AFTER ABOUT 3 YEARS OF RELATIVELY STANDARD USE?
    The only thing I may have done outside of the norm was some video editing, but very little.

    Look for solutions here:
    https://discussions.apple.com/docs/DOC-3521
    https://discussions.apple.com/docs/DOC-3353
    Ciao.

  • Simple Interface expired password change prompt

    We have a population of users who access GW exclusively through WebAcc. Some of this population has jumped on the mobile device bandwagon and so we've directed them to the simple interface when accessing GW from a mobile device.
    Some of these mobile device users now exclusively use the simple interface on their tablet/phone to access GW and when their password is expired, are never presented with the password change dialogue.
    Ive verified when user with an expired password navigates directly to the simple interface url , https://gwserver/gw/webacc?User.interface=simple, either on a mobile device or desktop browser, IE, FF, Chrome, the user consumes a grace login and is taken directly to the simple interface mailbox.
    Resetting grace logins and navigating to the standard webacc interface the GW password change dialogue is presented as expected.
    GroupWise 8.0.1 webacc on netware. I think wed refrained from going to newer releases in fear of some nasty bugs in the subsequent versions, but Ive not kept current on issues with the latest release.
    I understand the next GW version with native mobile device templates is around the corner, but management may want to address this sooner.
    Is this failure to recognize password expiry in the simple interface a know behavior?
    Regards,
    Fdiaz

    On 8/8/2011 8:36 AM, vodobaas wrote:
    > We have a population of users who access GW exclusively through WebAcc.
    > Some of this population has jumped on the mobile device bandwagon and so
    > we've directed them to the simple interface when accessing GW from a
    > mobile device.
    > Some of these mobile device users now exclusively use the simple
    > interface on their tablet/phone to access GW and when their password is
    > expired, are never presented with the password change dialogue.
    >
    > Ive verified when user with an expired password navigates directly to
    > the simple interface url ,
    > https://gwserver/gw/webacc?User.interface=simple, either on a mobile
    > device or desktop browser, IE, FF, Chrome, the user consumes a grace
    > login and is taken directly to the simple interface mailbox.
    > Resetting grace logins and navigating to the standard webacc interface
    > the GW password change dialogue is presented as expected.
    > GroupWise 8.0.1 webacc on netware. I think wed refrained from going to
    > newer releases in fear of some nasty bugs in the subsequent versions,
    > but Ive not kept current on issues with the latest release.
    > I understand the next GW version with native mobile device templates is
    > around the corner, but management may want to address this sooner.
    >
    > Is this failure to recognize password expiry in the simple interface a
    > know behavior?
    >
    > Regards,
    > Fdiaz
    I'll ask.

  • FPGA interface dynamic does not connect with FPGA interface based Vi

    Hi all,
       I have to use a vi (using an FPGA interface in in its inpouts), in an other Vi (which call directly FPGA Dynamic ( when i opened FPGA reference and configure with an FPGA vi or a bitfile the FPAGA interface take dynamic by default)
      but i cannot connect the two vi by they FPGA references (plz see picture).
      did anyone had had this problem before and what is the solution for that?
      Regards,
    SASA
    Attachments:
    553465_96.jpg ‏55 KB

    Hi GerdW,
      Thank you.
      it works with your solution, but it create another problem with another vi (see picture).
      Regards,
    SASA
    Attachments:
    synamic-simple-Interface-problem.jpg ‏47 KB

  • USB Hi-Speed vs FireWire 400 external drive write speed comparison

    Since there were a host of external hard drive questions, I thought I'd just try out my own speed test while I'm watching TV in the background.
    The drives I used were a bus-powered 250 GB LaCie Little Disk USB Hi-Speed + FireWire 400, and an adapter-powered 320 GB Western Digital MyBook Home USB Hi-Speed + FireWire 400 + eSATA. I judged the speed by running Activity Monitor and checking for Disk Activity's Data written/sec. There didn't appear to be much else happening, so I thought that the average rate was an accurate indicator. I plugged them directly into my MacBook's ports (no hubs or daisy-chaining).
    _LaCie Little Disk (using the USB power-sharing cable made no difference - I tried both):_
    USB: 23-25 MB/sec.
    FW400: 32-33 MB/sec
    _Western Digital MyBook Home (7200 RPM):_
    USB: steady 27 MB/sec
    FW400: 32-33 MB/sec
    So definitely FireWire won out, although I wasn't getting the same speeds as advertised. WD doesn't specify anything other than the interface's raw speed, and of course those are never achieved for bulk transfers due to negotiations, overhead, etc. LaCie advertises up to 41 MB/sec for FW400 and up to 34 MB/sec for USB.
    I found it a little bit strange that the LaCie drive was a bit slower with USB than the WD drive, but that could have to do with the particular chipset used.
    I was going to post the product page of the two drives I used, but I had one thread deleted because I posted a product webpage link without using it to answer a direct question.

    Oso Grande wrote:
    I love Firewire but what has really pushed it out of the home/prosumer market is the TON of cheap USB 2.0 drives available.
    I just pulled out my WD Passport Essential 160 GB drive with the original FAT32 format. I'm getting about 15-19 MB/sec although that was on my second try. The first try was only 12-14 MB/sec. Strange. I thought it would have been faster. I'm wondering if FAT32 makes a difference. Reads were at about 32-35 MB/sec, although there was a huge spike at the start before settling down to about 33 MB/sec.
    I forgot to mention that both drives in my first test were HFS+ formatted. The LaCie drive used Apple Partition Mapping as a backup for two PowerPC Mac backup partition and an additional swap space. The WD MyBook Home used GUID Partition Mapping. Let me give reads a try.

  • Intermittent data-speed issues with iPhone 4S

    I am using an iPhone 4S (64), iOS-5.1, AT&T carrier.
    Occasionally, when using Safari, there will be no response when I try to bring up a website, even when I'm showing full bars and 4G coverage. The "whirligig" wheel just keeps on spinning and spinning until the website-load times out. This problem is intermittent, but occurs semi-regularly. There seems to be no correlation with the strength of the signal I'm receiving, or my location, and I know that I have not had my data speed "throttled" as a result of being a heavy data user. I called the Apple Helpdesk one time and received the advice that I should, when this happens, go to >Settings, >General, >Reset, >Reset Network Settings. Although this usually works, it's inconvenient, and I'm seeking a more permanent solution.

    Last month I checked the data usage on my iPhone 4S three days after the start of a new billing cycle. To my shock I discovered that I had been charged with about 193 MB of usage. That was very odd because 193 MB is well above what my total data usage is each month. Immediately contacted AT&amp;T Customer Service--twice. Each time they could not provide an explanation as to why the data usage was charged to my phone. All they could tell me was that all of the 193 MB were charged on the very day the new billing cycle started. They did try to sell me a larger data plan.
    I thought maybe this was just an odd thing that couldn’t be explained. Kept a close eye on my data usage for the reminder of the billing cycle and didn’t have another large data charge. I still stayed well under the 300 MB plan limit even with the unexpected 193 MB of usage on day one.
    Then my wife checks her iPhone 4S data usage on day one of this month's billing cycle at about 9 AM. She finds that she has been charged with 30 MB of data usage when she hasn't even used her phone. Again, 9 AM; day one of new billing cycle; 30 MB of usage; no active applications running. How can this be? She contacted AT&amp;T Customer Service and once again they were no help. She made two phone calls and also spoke with one CS Manager, but no one could explain why she has been charged for the 30 MB. Anyone else having this problem? Please help us resolve this if you know what to do? Extremely frustrating to be charged for data we know we are not using. Getting no help from AT&amp;T Customer No-Service.   

  • Limitations of hyper-v in windows 8.1 in comparison with windows 2012 R2

    Hi frineds
    i am looking for a link or document to find out the limitations of hyper-v in windows 8.1 in comparison with windows 2012 R2. but i was unable to find a good link.
    may someone please help ? 

    check out the "Client Hyper-V Survival Guide"
    http://technet.microsoft.com/de-de/library/hh857623.aspx
    There a few features included in Windows Server  Hyper-V that are not included in Client Hyper-V. These include:
    Remote FX capability to virtualize GPUs (software GPU in RDP 8)
    Live VM migration
    Hyper-V Replica
    SR-IOV networking
    Synthetic fibre channel.
    Shared VHDx
    Udo
    beside the limitations the Hyper-V itself is the same Code
    http://www.altaro.com/hyper-v/introduction-client-hyper-v/
    Hi
    useful. thanks a lot

  • 1.4.2 vs 1.4.1_02 speed comparison

    Houston, we have a problem....
    I have a swing applet(JFrame) that updates 1800 JLabel boxes(yes they are tiny, no text) with a color.
    1.4.1_02 is about 8 times faster than 1.4.2 to initially update the screen after it displays
    by changing all the JLabel colors based on the data sent via socket connection from the server.
    I recompiled with 1.4.2 jsdk and loaded 1.4.2 jre on my win NT4.0sp6/Netscape 4.76 pc,
    updated my applet code for 1.4.2 plugins.
    1.4.1_01 takes about 2 seconds, 1.4.2 takes 10 seconds.
    If this is an indication of whats to come in 1.5, i'll be stuck with 1.4.1_02 forever.
    However, other applets that display a 2 megabyte JTable seem to be the same speed.
    No errors in java console.
    Does anybody see speed problems with JLabels or swing components in general?

    Perhaps you should create a test case and submit a bug against 1.4.2 indicating that it's a performance regression.

  • Areca 1882x speed drop with a BBU - expected?

    Anyone using an Areca ARC-1882x RAID controller with a BBU (Battery Backup Unit)? If so, any difference in performance with / without BBU, and did you have to change any settings?
    Here is what I am seeing on a client's Mac Pro with a CineRAID 12-bay tower SAS Expander:
    No BBU: 1000+MB/s write and 800 read speeds.
    BBU connected: 500 write and 350 read (and the read is stuttering). No background processed or anything else apparent in the dashboard.
    Areca's initial response: "When the BBU is connected, the controller will disable the disk internal cache for best data protection. A disk without internal cache will decrease performance."
    I didn't have a chance to poke around the settings yet - there's probably a way to turn the internal cache back on since to me, that's the whole point of the BBU protection - keeping the cache alive until the power is back on.
    Meantime, just I wanted to see if anyone ran into a similar issue and figured it out.

    I admit I have not tried results without the BBU attached. If you get me really curious, I may, but with the results I got - although the different tests showed remarkably different results, HDTune Pro, Crystal Disk Mark and AJA tests - I do not have the impression that results are negatively influenced by the BBU.
    It could be a MAC specific problem, since my observations are PC / Windows based.

  • How to Create an Input Schedule Comparison with Data Using EVDRE

    Hello,
    I try implement the scenario described in "How to Create an Input Schedule Comparison with Data Using EVDRE".
    Once I am using the "Insert Function" from the panel and selecting the EVTIM function Excel crashes (see page 8 How to paper).
    Systems:
    BPC 7.0 NW SP02
    Office 2007
    BPCADminClient and BPCOfficeClient up to date
    Have anyone a solution?
    Thanks
    Oktay

    Hi Oktay -
    This function works in my BPC70NW SP02 system. Your issue might be that you are trying to access a TIME member that does not exist. Please make sure the offset value is a valid dimension member.
    I can confirm that EVTIM does allow the offset for base members (such as 2009.MAY) as well as parent nodes (such as 2009.Q1 or 2008.TOTAL)... BUT...the offset result of the EVTIM function needs to be a valid dimension member!
    Regards,
    Sheldon

  • Comparison with other authoring tools

    Most of the time people get into one authoring tool like Encore, DVD Studio Pro, Sonic Solutions Authoring packages, ...
    I have the feeling with Encore 2.0 that it is not a professional package (but of course I could be wrong);
    a lot of possibilities, but not reliable and the result is not very professional.
    Subtitles don't look too great,
    a lot of bugs, really a lot,
    seamless transitions between animited menus,
    I'm curious to hear comparisons with other solutions which are professional, to orient and know more about the differences and similarities.
    DaLuna

    DVDit is ghastly.
    Encore is based on Sonic's DVD Producer, but has had a lot more of the options "Switched on" in the Authorcore. Plus of course it has a far better GUI compared to the Sonic one.
    Scenarist is seriously good, but seriously expensive, and as it is not an abstraction layer tool, it has it's own unique issues as well.
    If you want to try your hand with the scripting side of things, then you should have a look at DVD-Lab Pro.
    It's about to go to version 2, which will include goodies like Multi angle, Button Over Video, that sort of thing.
    It's only drawbacks compared to Encore are:
    1 - No DLT output.
    2 - No built-in Transcoding. You MUST feed it with DVD compliant assets.
    3 - Poor PSD support
    4 - No integration with other Adobe products
    BUT, it is well worth a look at $200

  • Speed issue with TC and Airport Express 802.11n in WDS mode...

    Here is my problem.
    I replaced my older base station / Express duo with
    a new Time Capsule (1TB) and a new Airport Express (802.11n).
    I set up the network with the TC as base station running a WDS network (WDS main) and the Express is the WDS remote.
    When I check the wireless clients from the TC, I find my iMac running at 130Mbits and the Extreme at 54Mbits.
    No other wireless clients are connected to the network (I kept my slower network as a parallel one for my "older" Macs).
    The only other connected device is my Dish network DVR that is connected via an Ethernet cable directly to the Express.
    So my question is why does the Express not communicate at >54 speed rate with the TC?
    And, why does my iMac connect with 130 and not with 300Mbits?
    Any thoughts?

    Instead of using WDS, you should take advantage of the "Allow this network to be extended" option that is available for the 802.11n AirPorts including the TC. WDS only operates in the 802.11g radio mode.
    Here's the basic setup:
    o If practical, place the base stations in near proximity to each other during the setup phase. Once done, move them to their desired locations.
    o Open AirPort Utility and select the base station that will connect to the Internet.
    o Choose Manual Setup from the Base Station menu, or double-click the base station to open the configuration in a separate window. Enter the base station password if necessary.
    o Click AirPort in the toolbar, and then click Wireless.
    o Choose “Create a wireless network” from the Wireless Mode pop-up menu, and then select the “Allow this network to be extended” checkbox.
    o Next, select the base station that will extend this network, and choose Manual Setup from the Base Station menu, or double-click the base station to open its configuration in a separate window. Enter the base station password if necessary.
    o Choose “Extend a wireless network” from the Wireless Mode pop-up menu, and then choose the network you want to extend from the Network Name pop-up menu.
    o Enter the base station network and base station password is necessary.
    o Click Update to update the base station with new network settings.
    (ref: Page 46 of "Designing AirPort Networks Using AirPort Utility).

Maybe you are looking for