Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Referencing home dir from Info.plist




On May 31, 2006, at 6:03 PM, Michael Hall wrote:


On May 31, 2006, at 6:16 PM, Greg Guerin wrote:


I don't quite see how writing a Java wrapper would be any better, and it
could be worse, because it probably takes longer to launch 'java' than it
does to run a shell script.

It's not that bad. Although I have no definite numbers to defend it either. 

This sounded like an exercise for the curious, so...


J.java (compiled with javac 1.5.0_06):
public class J {
    public static void main(String args[]) {
    }
}

C.c (compiled gcc -Os):
int main (int argc, char **argv)
{
    return 0;
}

S.sh:
eval

ctime.sh:
#!/bin/bash
I=0
while [ $I -lt 100 ]; do
  ./C
  let I=I+1
done

jtime.sh:
#!/bin/bash
I=0
while [ $I -lt 100 ]; do
  java J
  let I=I+1
done

stime.sh:
#!/bin/bash
I=0
while [ $I -lt 100 ]; do
  source S.sh
  let I=I+1
done


And the results by running 'time ./ctime.sh', etc 3 times each and taking the median value (on a MBP 2GHz):
Shell real time:  0.02s
Shell user time:  0.01s
Shell system time: 0.01s

C real time:  0.55s
C user time:  0.09s
C system time:  0.42s

Java real time:  18.12s
Java user time:  8.79s
Java system time:  3.98s


Does this matter in your particular case?  No, I certainly don't think so.
Does it mean that Java has *considerably* more overhead when starting up than C or a simple shell interpretation?  Yes.

Cheers,
Dominic

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: Referencing home dir from Info.plist (From: Greg Guerin <email@hidden>)
 >Re: Referencing home dir from Info.plist (From: Michael Hall <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.