Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (407)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Java becoming a non-deterministic runtime?  (Read 1185 times)
0 Members and 1 Guest are viewing this topic.
Offline genepi

Senior Newbie




azerty


« Posted 2004-02-27 14:49:30 »

Hi,

I don't know if you feel like me, but I think that Sun is turning Java in a non-deterministic language. I'll try to explain...

I've been used to languages where one could say that a loop control structure is O(N). In ol' BASIC days,
1  
FOR i = 1 TO N
took a time proportional to the value of N (at least when the code in the loop is constant and the compiler does not do too much agressive code removal). There are other parameters like the platform, but at least, you could do an algorithmic analysis and optimize your source code on the paper without event running it.

Now, with the Java runtime, the performance of some code depends on soo many runtime parameters:
- The JVM type (Sun, IBM, BEA...)
- The JVM compiler type: Hotspot -server or -client. Has the loop run enough to raise the hotspot compiler?
- The JVM parameters: -incgc and surch -X non-portable options.
- And of course platform: you don't write the same code for J2ME or J2SE. On J2ME, you MUST manage your objects allocations.

The programmer has less options to write optimized code and the performance depends on the runtime environment.
As a consequence, when you do a change in your code, you can't predict the impact it'll have on performance.
Remember when code was cluttered with object pools to compensate for the garbage collector poor performance?

Now, I fear to write clean code, with correct performance with today VM (and its tuned runtime parameters) and to discover in a few years that the code+tuning parameters are no more valid with current VM...  Nowadays, you take care not to create objects in a critical time loop, but how will run this code when JVM implement escape analysis or other techniques?
Offline Mark Thornton

Senior Member





« Reply #1 - Posted 2004-02-27 15:26:11 »

Nothing really new in this. The performance of malloc in C/C++ (and related methods) has often depended on external factors. The extent of this dependence use to change with each successive release of Microsoft's C compiler/libraries. It would become more or less tied to the performance of the platforms allocator (which was outside of your exe).
The problem isn't quite as bad as you suggest, because in most cases the performance simply improves with later versions. The only catch being that had you used simpler code (such as not moving allocations out of loops), it might have improved more.
If you restrict your more devious performance tricks to those small areas where it is really needed then you don't have to change too much code when the JVM improves.
Offline erikd

JGO Knight


Medals: 3
Projects: 3


Maximumisness


« Reply #2 - Posted 2004-02-27 15:51:45 »

I can understand your fear/doubts, but as I see it is that it's not really a problem but merely a sign of improvement.
For example, my 1.1 MSVM targeted applets run as fast or faster on my current PC with current JVM than the target machine I had for those applets at the time. Even though some 1.1 typical functions perform a bit worse on todays JVM's and I used some typical 'old school' optimizing techniques that might affect performance negatively on today's JVMs, the PC's got faster to compensate.

Games published by our own members! Check 'em out!
Play the free demo of Revenge of the Titans!
Offline Jeff

JGO Coder




Got any cats?


« Reply #3 - Posted 2004-02-28 04:56:08 »

Youve missed the point im afraid.

EVERY step we've taken with Java performance has been to imrpove the performance of exactly what you are talkign abotu writing: clear, clean, well encapsulated code.

Today Java can do so FAR better then C++ for instance where you sill have to sacrafice clarity and clean OOP in fvaor of the kind of hand-tuning you are talkign about.

So don't worry, be happy.  Write clear, clean well encapsulated code that makes it as clear as possible to the VM what your intentions are and you will get the best performance.

Its shift of mindset, but a good one!


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Try the Free Demo of Revenge of the Titans

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (98 views)
2013-05-17 21:29:12

alaslipknot (106 views)
2013-05-16 21:24:48

gouessej (136 views)
2013-05-16 00:53:38

gouessej (131 views)
2013-05-16 00:17:58

theagentd (143 views)
2013-05-15 15:01:13

theagentd (129 views)
2013-05-15 15:00:54

StreetDoggy (172 views)
2013-05-14 15:56:26

kutucuk (194 views)
2013-05-12 17:10:36

kutucuk (196 views)
2013-05-12 15:36:09

UnluckyDevil (202 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.108 seconds with 20 queries.