|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Learning to Program in Java
I came across a weird thought in this process. One of my teachers, who teaches C++ and Java, told me that when you program and compile Java Code [not to robot, but for animation for example], and when you compile C++ [not to robot, but for animation for example], and you execute them both, and if they did the same thing, all same except the syntax of course, that C++ does the compiling and executing a little faster then Java. First of all is this true for the robot, and if it is, what possible effects could it have?
|
|
#2
|
|||||
|
|||||
|
Re: Learning to Program in Java
Quote:
One other factor that has traditionally scared roboticists away from Java is garbage collection. In C/C++, memory is allocated and freed by the programmer directly. In Java, memory is periodically freed when needed (a process called garbage collection). While this makes a programmer's life much, much easier, it means that sometimes the system will decide to do garbage collection at an inopportune time, causing you to miss real time deadlines. However, once again there has been some advancement in this area that has turned this issue from show stopper to mere nuisance. I don't think we'll see an enormous performance difference between Java and C++ on our cRIOs. Besides, most teams are only scratching the surface of what the cRIO can do. And good Java is both more robust and oftentimes faster than bad C++ - if a team isn't comfortable with C++, any code that they produce may well end up being faster in their Java implementation anyways. |
|
#3
|
||||
|
||||
|
Re: Learning to Program in Java
Quote:
|
|
#4
|
|||
|
|||
|
Re: Learning to Program in Java
There will be a difference, but since much of the heavy lifting is done by the FPGA, the differences will often not show up. Also since another expensive element, vision, is being done by an optimized binary library written in C, the differences again will not show up.
Raw arithmetic for control or other processing carried out on the cRIO will show the differences, and I'm as eager as anyone to see how they compare. LV is a compiled language, not a VM, but a good VM can beat a bad compiler. As with most engineering tasks, it will be a system of tradeoffs where performance is not the only thing to be concerned with. The ability to debug well and quickly modify code may be more important than the runtime performance. Greg McKaskle |
|
#5
|
|||
|
|||
|
Re: Learning to Program in Java
I once was designing a program to perform several million iterations and distance calculations. I worried constantly about memory and time. When it was run in java it executed in just under 1 second.
1 second. I gave up on the differences between C++ and Java at that point. |
|
#6
|
|||||
|
|||||
|
Re: Learning to Program in Java
What i'm hoping is the software will run on windows 7
|
|
#7
|
||||
|
||||
|
Re: Learning to Program in Java
If not, you can always run the software in compatibility mode.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Canera Calibration- Java program | itsme | Programming | 1 | 20-01-2007 16:14 |
| Robocode: Learning JAVA the fun way. While fighting with robots. | Denalin Fusion | Chit-Chat | 2 | 26-09-2005 23:22 |
| java to pbasic | nzj1 | Programming | 11 | 09-01-2003 19:24 |
| Java Books | Yan Wang | Programming | 1 | 27-12-2002 16:26 |
| No Java for XP | Kyle Fenton | Chit-Chat | 21 | 23-07-2001 20:15 |