Go to Post The mission of FIRST is not just to promote science and technology, but to help every student involved to reach their full potential and achieve their dreams - Mike Ciance [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 22-09-2010, 12:26
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Java versus C++

Quote:
Originally Posted by eagle33199 View Post
... C++ can be slower than Java (Pointers are time consuming to handle for C++, malloc sucks, performance wise. You don't have those problems with Java).

Can you please provide an authoritative reference, or experimental data, to support the claims that:

1) properly-written code using pointers in C++ runs slower than functionally equivalent code written in Java

and

2) properly-written code using malloc in C++ runs slower than functionally equivalent code written in Java

Thanks!



  #17   Spotlight this post!  
Unread 22-09-2010, 13:33
AustinSchuh AustinSchuh is offline
Registered User
FRC #0971 (Spartan Robotics) #254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Los Altos, CA
Posts: 803
AustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond repute
Re: Java versus C++

My understanding is that the JVM that's been ported to the cRIO is the squawk VM, which is not a real-time VM. While you might have your own opinions about the importance of a system being real-time or not, that was something that played into our thought process.
  #18   Spotlight this post!  
Unread 22-09-2010, 15:56
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Java versus C++

Quote:
Originally Posted by AustinSchuh View Post
My understanding is that the JVM that's been ported to the cRIO is the squawk VM, which is not a real-time VM. While you might have your own opinions about the importance of a system being real-time or not, that was something that played into our thought process.
Could someone knowledgeable about this please weigh in on this?

It was my understanding (perhaps incorrect) that the 2010 FRC Framework for Java was written in such a way to use the underlying vxWorks RTOS to handle the realtime aspects, thus mitigating the lack of true built-in realtime support in the VM. Not?



  #19   Spotlight this post!  
Unread 22-09-2010, 17:13
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,082
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Java versus C++

Quote:
Originally Posted by davidthefat View Post
I will tell you that it is easier to code with Java. It can be a pain in the $@#$@#$@# to fix a memory leak in C++ because of a misused pointer... But personally I love C++
Ah, but contemporary idiomatic C++ should almost never require the use raw pointers

Quote:
Originally Posted by AustinSchuh View Post
My understanding is that the JVM that's been ported to the cRIO is the squawk VM, which is not a real-time VM. While you might have your own opinions about the importance of a system being real-time or not, that was something that played into our thought process.
All of the calls to the vision API, FPGA/peripherals, watchdog, semaphores, etc., are simply wrappers to the underlying equivalent system primitives (fast VxWorks and/or FPGA code). As for a "real-time VM", the Real Time Specification for Java (RTSJ) that is implemented by Sun's Java Real-Time System and a few other libraries (but not Squawk) just means that performance is deterministically bounded, not necessarily any faster. In particular, it enforces that memory management and multi-threaded execution/scheduling always happens in the same way.

All of this really only matters if you are in a hard-real time, safety-critical situation. If for example you are building an airbag deployment system, you have a few milliseconds to react to a crash. In this scenario you can't afford the one in a million chance that your code is busy garbage collecting and thus blocking the execution of the real-time critical bit. In a FIRST robot, missing a real-time deadline by a little bit is (a) not going to be life threatening and (b) not going to occur often at all anyway. The worst possible scenario would be a fast software control loop ending up with a little bit more jitter (variation in time between calls).

Last edited by Jared Russell : 22-09-2010 at 19:33.
  #20   Spotlight this post!  
Unread 22-09-2010, 17:53
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Java versus C++

Quote:
Originally Posted by AustinSchuh View Post
My understanding is that the JVM that's been ported to the cRIO is the squawk VM, which is not a real-time VM. While you might have your own opinions about the importance of a system being real-time or not, that was something that played into our thought process.
Can someone explain why JVN is squawking in real-time? I thought John VNeun was more of a mechanical guy.



I'm sorry, but I can't help but misread JVM as JVN, at least in an FRC context.
  #21   Spotlight this post!  
Unread 22-09-2010, 22:28
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,756
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Java versus C++

While I'm pretty sure I can build a car that operates more slowly than a bike, or find a turtle that outruns a hare, I'd caution against drawing general conclusions from such benchmarks.

One of the fundamental underpinnings of computer science is examining a problem and determining the inherent complexity, looking at a solution and determining the way it scales based on it's inputs, and getting beyond qualitative terms such as fast and slow.

You have choices as to which tools to use, and I wouldn't personally base the decision on runtime performance. Instead look what will support agility, productivity, and reliability. Also consider what enables your team to learn new things and to pass the knowledge on to the next generation of your team.

Greg McKaskle
  #22   Spotlight this post!  
Unread 22-09-2010, 23:31
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: Java versus C++

Quote:
Originally Posted by Jared341 View Post
Ah, but contemporary idiomatic C++ should almost never require the use raw pointers
Aware me of this programmer lingo... As I said before, I am self taught so I don't have all the lingo down. I just do it If you know what I mean, I don't name what I do.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
  #23   Spotlight this post!  
Unread 22-09-2010, 23:40
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Java versus C++

Quote:
Originally Posted by davidthefat View Post
Aware me of this programmer lingo... As I said before, I am self taught so I don't have all the lingo down. I just do it If you know what I mean, I don't name what I do.
Just Google the phrase "C++ idioms".



  #24   Spotlight this post!  
Unread 23-09-2010, 02:53
timothyb89 timothyb89 is offline
code monkey
FRC #1977 (Loveland High Robotics)
Team Role: Alumni
 
Join Date: Oct 2008
Rookie Year: 2009
Location: Loveland, Colorado
Posts: 45
timothyb89 will become famous soon enough
Re: Java versus C++

As far as I know, Squawk (or any other J2ME implementation I've heard about) doesn't support JIT, so cRIO-java is stuck in interpreted mode. This likely ends up slowing down any particularly intensive logic-only calculations due to the lack of native code execution. One of the biggest speed boosts in desktop Java (and some other loosely Java-based systems like Android) are JIT-related. For some context, the JIT support added to Android in the latest release gave it around a 50% speed boost.

Overall, though, the cRIO is powerful enough to accommodate basically anything we'll need to do with our bots. Maybe Vision-related stuff would suffer a slowdown, but for the most part that's offloaded to (prebuilt) native libraries.

Having used Java this year, I can say that there were a few performance-related issues, but a lot of them were due to us having a pretty large number of simultaneous threads running (one being unused vision processing which happily ate away at our CPU time). In the end, a quick sweep through some of the unused code cleared it up. And it definitely won't stop us from using Java again this year - the issues we had there were nothing compared to our trouble with LabVIEW and C++ in '09.
__________________
FRC-DB: A detailed, web-based scouting database for FRC teams with lots of interesting statistics.
  #25   Spotlight this post!  
Unread 23-09-2010, 07:23
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,082
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Java versus C++

Quote:
Originally Posted by timothyb89 View Post
As far as I know, Squawk (or any other J2ME implementation I've heard about) doesn't support JIT, so cRIO-java is stuck in interpreted mode. This likely ends up slowing down any particularly intensive logic-only calculations due to the lack of native code execution. One of the biggest speed boosts in desktop Java (and some other loosely Java-based systems like Android) are JIT-related. For some context, the JIT support added to Android in the latest release gave it around a 50% speed boost.
Actually, Squawk does indeed support JIT (see this).
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate 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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
**FIRST EMAIL**/Java and Orbit Balls *****JAVA DISCUSSION*** Pjohn1959 Programming 37 31-08-2009 15:55
Cable Versus Chain Darren Collins Technical Discussion 1 14-01-2008 22:29
Bernoullis versus Continuity Corey Balint Math and Science 13 15-09-2007 17:59
PC versus Console Denman Chit-Chat 40 22-05-2005 18:01
Reigonals versus startegies MisterX Rules/Strategy 11 29-03-2004 00:04


All times are GMT -5. The time now is 03:45.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi