- Quick Menu
-
|

12-29-2009
|
|
Member
|
|
Join Date: Jun 2009
Posts: 74
Rep Power: 3
|
|
|
Any software engineer today that claims Java is slow is incompetent.
|

12-29-2009
|
|
Sea Slacker
|
|
Join Date: Jan 2007
Posts: 1,771
Rep Power: 6
|
|
Quote:
Originally Posted by legarots
Any software engineer today that claims Java is slow is incompetent.
|
I am a software engineer  I am quite competent, thank you very much. I claim that many common processing tasks would execute considerably more slowly when implemented in Java as compared to the same tasks implemented in language compiled to native code (such as C or C++). I would say that, though generalizations are not my speciality, can be a basis for saying "Java is slow"
Would you like to place a bet, put your money where your mouth is, so to speak?
P.S. Although this does not really belong here, below is a very trivial test case. Allocate an array, fill with numbers, repeat.
C version.
Quote:
#include
#include
int main(int ac, char **av)
**
int len, *arr = NULL, rep, i, j;
len = atoi(av[1]);
rep = atoi(av[2]);
printf("Size: %d, reps: %d\n", len, rep);
arr = (int *)malloc(sizeof(int) * len);
for (j = 0; j < rep; ++j) **
for (i = 0; i < len; ++i) **
arr[i] = i + j;
}
}
free(arr);
return 0;
}
|
Java version (fairly literal copy, as you can see)
Quote:
public class Test
**
public static void main(String [] args)
**
int i, j, len, rep;
len = Integer.parseInt(args[0]);
rep = Integer.parseInt(args[1]);
System.out.printf("Size: %d, Reps: %d\n", len, rep);
int arr[] = new int[len];
for (j = 0; j < rep; ++j) **
for (i = 0; i < len; ++i) **
arr[i] = i + j;
}
}
}
}
|
Compile and run:
Quote:
> gcc -O2 -o test test.c
> javac Test.java
> time ./test 1000000 3000
Size: 1000000, reps: 3000
real 0m3.035s
user 0m2.990s
sys 0m0.028s
> time java Test 1000000 3000
Size: 1000000, Reps: 3000
real 0m8.427s
user 0m8.216s
sys 0m0.103s
|
Feel free to do it yourself  Note the close to 3x time difference.
Pardon the poor formatting, quote tag does not seem to keep spaces and tabs.
Last edited by brak; 12-29-2009 at 05:55 PM.
|

12-29-2009
|
 |
Arf!
|
|
Join Date: Apr 2002
Location: Long Island NY
Posts: 606
Rep Power: 11
|
|
Quote:
Originally Posted by sailingfool
Not to be too picky, but I don't beleive your phone has GPS capabilities...I believe like the iphone it uses cell towers and/or wifi to locate itself, if its in an area with suitable signals, not GPS.
|
I don't mind your being picky but you are wrong.
The phone has both. When the GPS is turned off it reverts to the cell tower triangulation and shows it with a bloated circle of confusion. The GPS coords are accurate within 10 ft.
__________________
Fluctuat nec mergitur
|

12-29-2009
|
|
Sea Slacker
|
|
Join Date: Jan 2007
Posts: 1,771
Rep Power: 6
|
|
Quote:
Originally Posted by pegasus1457
I don't mind your being picky but you are wrong.
The phone has both. When the GPS is turned off it reverts to the cell tower triangulation and shows it with a bloated circle of confusion. The GPS coords are accurate within 10 ft.
|
Actually, according to Wikipedia (and what I seem to recall from elsewhere) "The iPhone 3G and iPhone 3GS employ A-GPS". That's not quite a true GPS, though it's not triangulation either. However, A-GPS does not work if the phone is not talking to a tower (in fact, it needs to talk to a properly equipped/connected tower). As far as I understand, A-GPS (assisted gps) receives satellite signals directly to the device. However, rather than processing these signals on the device, it forwards them to the special network server which does the actual calculations and then returns the location back to the device. So the current iPhone 3G will not provide GPS functionality when not connected to the network, presumably.
(Interesting, I never tested that - will try later today)
|

12-29-2009
|
 |
Arf!
|
|
Join Date: Apr 2002
Location: Long Island NY
Posts: 606
Rep Power: 11
|
|
|
Nav app for android
I have been active in a thread on anything-sailing.com, on this subject, which I will summarize:
There is an app (Orux Maps) for the android platform that displays your GPS location on a raster-scanned chart. The quality of the chart rendering is acceptable, and entering waypoints is possible, but the app has no way to lay down a route. [The developer is a hiker!]
The raster scanned charts are available at no cost from NOAA, but they have to be chewed up and recast as little morsels that can be downloaded to and displayed on the mobile device screen. - The developer of Orux Maps has a desktop utility that will take you part of the way. You need to start with a calibration file (.map) and an extracted raster-scan graphic file (.jpg or .png).
- I have developed code which bridges this gap: it starts with the BSB files from NOAA and generates the .map and .png files.
- It runs on a MacOS desktop or in a cygwin (unix-like) environment on Windows machine.
[If someone has a Windows development toolset for C, the source files are posted as noted in the thread cited above; if you want to build a Windows app it would be a service to many in this community.]
For more details see the thread on Anything Sailing Forumhttp://www.anything-sailing.com/look...6665#post66665
__________________
Fluctuat nec mergitur
|

12-29-2009
|
 |
Arf!
|
|
Join Date: Apr 2002
Location: Long Island NY
Posts: 606
Rep Power: 11
|
|
Quote:
Originally Posted by brak
So the current iPhone 3G will not provide GPS functionality when not connected to the network, presumably.
(Interesting, I never tested that - will try later today)
|
I will be taking my phone to Europe next month, where there is no Verizon-compatible service. I will check out the GPS behavior and get back with a report.
__________________
Fluctuat nec mergitur
|

12-29-2009
|
 |
Arf!
|
|
Join Date: Apr 2002
Location: Long Island NY
Posts: 606
Rep Power: 11
|
|
Quote:
Originally Posted by brak
Feel free to do it yourself  Note the close to 3x time difference.
|
Never could pass up a challenge.
On my machine (MacOS 10.6.2, 2.4 GHz Intel Core 2 Duo, 2GB 667 MHz DDR2) I get completely different results from yours:
pegasus2:~/test_java] mjl% time test 1000000 3000
Size: 1000000, reps: 3000
2.686u 0.006s 0:02.69 99.6% 0+0k 0+0io 0pf+0w
mjl% time java Test 1000000 3000
Size: 1000000, Reps: 3000
3.106u 0.065s 0:03.16 100.0% 0+0k 1+7io 0pf+0w
I get only slightly slower execution in java than in compiled C.
__________________
Fluctuat nec mergitur
Last edited by pegasus1457; 12-29-2009 at 09:18 PM.
Reason: forgot the -O2 flag the first time
|

12-29-2009
|
 |
Arf!
|
|
Join Date: Apr 2002
Location: Long Island NY
Posts: 606
Rep Power: 11
|
|
Quote:
Originally Posted by brak
Actually, according to Wikipedia (and what I seem to recall from elsewhere) "The iPhone 3G and iPhone 3GS employ A-GPS". That's not quite a true GPS, though it's not triangulation either. However, A-GPS does not work if the phone is not talking to a tower (in fact, it needs to talk to a properly equipped/connected tower).
|
Re the platform I am using (HTC Eris):
HTC Droid Eris | Android Devices
This site claims there is a built-in GPS (other devices profiled on this site claim GPS/aGPS)
__________________
Fluctuat nec mergitur
|

12-30-2009
|
|
Sea Slacker
|
|
Join Date: Jan 2007
Posts: 1,771
Rep Power: 6
|
|
Quote:
Originally Posted by pegasus1457
Never could pass up a challenge.
On my machine (MacOS 10.6.2, 2.4 GHz Intel Core 2 Duo, 2GB 667 MHz DDR2) I get completely different results from yours:
|
Cool stuff. My test machine is not too dissimilar:
2.16 Ghz Intel Core 2 Dua, 3Gb 667 Mhz DDR2, MacOS 10.5.8
The difference in "real" run time for C is almost exactly proportional to processor speed-up (2.69/3.03 vs 2.16/2.4), so no surprises there.
So clearly Java is working a lot faster (though 20% difference is still nothing to sneeze at, i.e. I am completely refactoring chart handling code now and if I get 20% out of that I'd be extatic  ).
Here is what my java says: java version "1.5.0_20"
What do you have on your machine?
If I am not too busy later I'll boot up and try it on my friendly Linux box (no Java compiler on windows).
|

12-30-2009
|
|
Sea Slacker
|
|
Join Date: Jan 2007
Posts: 1,771
Rep Power: 6
|
|
Visual C Express for Windows is free nowadays - so anyone can get a functional windows development environment at no cost.
RainDog - so here is one place where someone can definitely build an integrated solution (end to end "something" so that users don't have to go through the hassle). May be even more interesting to preprocess all those charts on *your* server and then have a program that downloads those pre-processed cells directly. And that's a proven way to get charts working on Android, no unknowns.
Quote:
Originally Posted by pegasus1457
I have been active in a thread on anything-sailing.com, on this subject, which I will summarize:
There is an app (Orux Maps) for the android platform that displays your GPS location on a raster-scanned chart. The quality of the chart rendering is acceptable, and entering waypoints is possible, but the app has no way to lay down a route. [The developer is a hiker!]
The raster scanned charts are available at no cost from NOAA, but they have to be chewed up and recast as little morsels that can be downloaded to and displayed on the mobile device screen. - The developer of Orux Maps has a desktop utility that will take you part of the way. You need to start with a calibration file (.map) and an extracted raster-scan graphic file (.jpg or .png).
- I have developed code which bridges this gap: it starts with the BSB files from NOAA and generates the .map and .png files.
- It runs on a MacOS desktop or in a cygwin (unix-like) environment on Windows machine.
[If someone has a Windows development toolset for C, the source files are posted as noted in the thread cited above; if you want to build a Windows app it would be a service to many in this community.]
For more details see the thread on Anything Sailing Forumhttp://www.anything-sailing.com/look...6665#post66665
|
|
|
Currently Active Users Viewing This Thread: 2 (0 members and 2 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
|
Setting Up Your Nav Station
|
Sue & Larry |
Gear and Maintenance Articles |
0 |
07-26-2002 08:00 PM |
All times are GMT -4. The time now is 08:33 PM.
|