|
|
K.I.L.E.R
Senior Member   
Java games rock!
|
 |
«
Reply #1 - Posted
2005-03-16 04:33:41 » |
|
I'm am definitely drooling. Did my blog have an effect on this decision? 
|
Vorax: Is there a name for a "redneck" programmer? Jeff: Unemployed. 
|
|
|
princec
|
 |
«
Reply #2 - Posted
2005-03-16 09:03:58 » |
|
Aha, that'd be nice. One less performance gotcha to worry about. Cas 
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Linuxhippy
|
 |
«
Reply #3 - Posted
2005-03-21 20:11:16 » |
|
Would be really great to see some progress in this topic!
|
|
|
|
|
phazer
Junior Member  
Come get some
|
 |
«
Reply #4 - Posted
2005-03-22 06:45:42 » |
|
There is some (very little) info about this in the HotSpot team chat transcript: "Spiff: The memory overhead for small Java objects can be a killer for some applications. For example, a Triangle object which holds 3 Point3f's. Since HotSpot has an 8-byte per-object overhead plus 8-byte alignment, each of those Point3f's occupy 24 bytes, where they would occupy 12 bytes with C/C++. Are there any plans to perhaps inline (memory-wise) small objects, say if you can guarantee that you'll only refer to them through their containing parent object? Ross Knippel: On the compiler side, we're planning on doing escape analysis, which may allow these objects to be scalarized and therefore never created. There are no current plans to inline one object into another. " The full transcript is available at http://java.sun.com/developer/community/chat/JavaLive/2005/jl0315.html. Btw, Spiff == princec ? 
|
|
|
|
princec
|
 |
«
Reply #5 - Posted
2005-03-22 08:12:24 » |
|
Nah, I'm always princec. Cas 
|
|
|
|
Spiff
Senior Newbie 
Java games rock!
|
 |
«
Reply #6 - Posted
2005-03-22 13:34:17 » |
|
Spiff == Spiff.
I've been bitten by small-object overheads. There are workarounds (such as creating a float array for all vertices and having multiple triangles index into that array) but it would still be nicer to be able to have small objects w/out the overhead.
|
|
|
|
|
princec
|
 |
«
Reply #7 - Posted
2005-03-22 13:53:34 » |
|
You appear to have gotten a little confused about what you actually want in that post... object overhead is insignificant in terms of memory efficiency in the situations where escape analysis is useful. EA is used to prevent taxing the garbage collector unnecessarily. What you want is Structs!Cas 
|
|
|
|
Raghar
Junior Member  
Ue ni taete 'ru hitomi ni kono mi wa dou utsuru
|
 |
«
Reply #8 - Posted
2005-03-22 18:38:56 » |
|
Why so ugly word as struct? Formated array in nicer.
" where they would occupy 12 bytes with C/C++. " Actually they don't. You should add a pointer to an array so it would be 16 to 20 bytes.
From my knowledge about graphic programming I know the preffered way is a batch processing, so you'd have float array/s anyway. I however forgot what's better for CPU/GFX pipeline. Three float arrays, or one (or multiple) layered arrays.
Yes, I have also discovered a small object overhead aka 1000 times nothing killed donkey. It hurted a little my binary model for compression, but I think the solution is actually more L2 cache efficient, so it's not as harsh problem.
|
|
|
|
|
princec
|
 |
«
Reply #9 - Posted
2005-03-22 19:08:20 » |
|
I wish I'd called them "Mapped Objects" now. Cas 
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Raghar
Junior Member  
Ue ni taete 'ru hitomi ni kono mi wa dou utsuru
|
 |
«
Reply #10 - Posted
2005-03-22 20:08:42 » |
|
Yes it would be better idea. Less problem with programmers that are used to an exact C meaning of the word struct.
|
|
|
|
|
Deadcow
Senior Newbie 
Back from beyond ... Moo!
|
 |
«
Reply #11 - Posted
2005-03-23 07:13:02 » |
|
Hi there, princec, there is maybe a way to implement this functionality without any addition to the java language : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| package java.nio;
public abstract class ObjectBuffer extends Buffer {
public ObjectBuffer( int capacity ) { ... } public ObjectBuffer( ByteBuffer buffer ) { ... }
public ObjectBuffer duplicate(); public ObjectBuffer slice(); }
package org.lwjgl....;
@Pack(4) public VertexBuffer extends ObjectBuffer {
public VertexBuffer( int capacity ) { ... } public VertexBuffer( ByteBuffer buffer ) { ... }
public @Mapped float x; public @Mapped float y; public @Mapped float z; public @Mapped float nx; public @Mapped Object o;
} |
the @Mapped fields' values depend on the current ObjectBuffer position. Does it suits your needs ?
|
|
|
|
|
princec
|
 |
«
Reply #12 - Posted
2005-03-23 08:09:22 » |
|
I was coming to the conclusion that the Java language no longer needs to be modified thanks to annotations. With annotations the JVM could do some clever internal compilation to remove all the unnecessary bounds checking and read/write fields directly from a DirectByteBuffer. Cas 
|
|
|
|
K.I.L.E.R
Senior Member   
Java games rock!
|
 |
«
Reply #13 - Posted
2005-03-23 09:03:23 » |
|
Can you expand on this a little? I'm interested in what I think you mean. The only problem is that I don't know if what you mean is the same thing as what I think you mean. Can you use annotations to create arrays without bounds checking currently? I was coming to the conclusion that the Java language no longer needs to be modified thanks to annotations. With annotations the JVM could do some clever internal compilation to remove all the unnecessary bounds checking and read/write fields directly from a DirectByteBuffer. Cas 
|
Vorax: Is there a name for a "redneck" programmer? Jeff: Unemployed. 
|
|
|
princec
|
 |
«
Reply #14 - Posted
2005-03-23 10:10:56 » |
|
Most annotations do nothing. What they do do, however, is embed a little hint in the bytecode for the VM. So if you stated that an object extended, say, MappedObject, then you could mark the mapped fields with the @Offset(position) annotion, and the VM could use this information to write highly optimised machine code to do the memory access for you. Otherwise the VM would simply have to generate the bytecode behind the scenes to labouriously call get/set on the underlying buffers for all the field accesses - which would be the fallback anyway. Cas 
|
|
|
|
K.I.L.E.R
Senior Member   
Java games rock!
|
 |
«
Reply #15 - Posted
2005-03-23 10:30:29 » |
|
How do you know they aren't doing this already? If not they probably planned this when adding annotations. Most annotations do nothing. What they do do, however, is embed a little hint in the bytecode for the VM. So if you stated that an object extended, say, MappedObject, then you could mark the mapped fields with the @Offset(position) annotion, and the VM could use this information to write highly optimised machine code to do the memory access for you. Otherwise the VM would simply have to generate the bytecode behind the scenes to labouriously call get/set on the underlying buffers for all the field accesses - which would be the fallback anyway. Cas 
|
Vorax: Is there a name for a "redneck" programmer? Jeff: Unemployed. 
|
|
|
dleskov
|
 |
«
Reply #16 - Posted
2005-03-26 07:07:31 » |
|
For those interested in trying out escape analysis in Java today, we have just released Excelsior JET 3.7, which has escape analysis much improved and object explosion implemented. Download
|
|
|
|
princec
|
 |
«
Reply #17 - Posted
2005-03-26 14:33:54 » |
|
<--- I recommend Jet, it really is as good as they claim. Pro version could be a little cheaper though eh? Cas 
|
|
|
|
Azeem Jiva
Junior Member  
Java VM Engineer, Sun Microsystems
|
 |
«
Reply #18 - Posted
2005-03-26 22:30:05 » |
|
<--- I recommend Jet, it really is as good as they claim. Pro version could be a little cheaper though eh? Cas  Can you give me some numbers? Say against Java5, how much of an improvement do you see in your apps?
|
|
|
|
|
phazer
Junior Member  
Come get some
|
 |
«
Reply #19 - Posted
2005-03-27 08:54:11 » |
|
For those interested in trying out escape analysis in Java today, we have just released Excelsior JET 3.7, which has escape analysis much improved and object explosion implemented. Download Cool. You don't have any plans to offer a free license for open source projects?
|
|
|
|
princec
|
 |
«
Reply #20 - Posted
2005-03-27 14:24:59 » |
|
I've not compared it to Java "5". In fact the last version of Jet I used was 3.15 which is 2 years old and it consistently outperformed the 1.4 server VM for games programming - utterly beating it at load times and managing parity during execution time. Cas 
|
|
|
|
dleskov
|
 |
«
Reply #21 - Posted
2005-03-28 06:04:33 » |
|
<--- I recommend Jet, it really is as good as they claim. Pro version could be a little cheaper though eh? We are running an v3.7 introductory offer by April 15th. Pro license price is 1/3 off, and you can get Windows and Linux versions together at the price of one of them. Upgrade prices are also reduced. If this is cheap enough, go download the eval, but mind that you have less than 20 days left. 
|
|
|
|
dleskov
|
 |
«
Reply #22 - Posted
2005-03-28 06:49:46 » |
|
Can you give me some numbers? Say against Java5, how much of an improvement do you see in your apps? We are running various benchmarks against the latest version of HotSpot client and server and JRockit right now and will publish them on our Web site soon. We will also publish all scripts, project files and instructions required to run the tests on your system. If you do not trust vendor benchmarks, why not try it yourself against your own tests or, even better, a real app?
|
|
|
|
dleskov
|
 |
«
Reply #23 - Posted
2005-03-28 07:04:59 » |
|
Cool. You don't have any plans to offer a free license for open source projects?
First of all, note that Excelsior is revenue-funded, and providing support costs money. So we have to be careful about giving away stuff if we want to preserve the quality of our support. We have plans to offer a special license for non-commercial and non-institutional usage, regardless of whether the project is open source. Considering the first paragraph, it will be cheap, but likely not free. But we would surely give it to you for free in exchange for something valuable to us. For instance, you may participate in our beta test program or promote our product on your Web site or elsewhere, etc. We also have plans for subscriptions and pay-as-you-go licensing, so as to remove the upfront cost barrier on commercial usage patterns such as shareware.
|
|
|
|
phazer
Junior Member  
Come get some
|
 |
«
Reply #24 - Posted
2005-03-28 09:23:10 » |
|
First of all, note that Excelsior is revenue-funded, and providing support costs money. So we have to be careful about giving away stuff if we want to preserve the quality of our support.
Yes, I fully understand that (I work on a commercial Java product myself). I'm in no position to argue what licensing schemes you should have, but a suggestion would be that you provide a free, case-by-case, no-support license for open source projects. The license could require the projects to explicitly state that the binary was produced with Jet, giving you free publicity for your product. I think both parties could benefit from such a license.
|
|
|
|
dleskov
|
 |
«
Reply #25 - Posted
2005-03-28 09:36:14 » |
|
I'm in no position to argue what licensing schemes you should have, but a suggestion would be that you provide a free, case-by-case, no-support license for open source projects. The license could require the projects to explicitly state that the binary was produced with Jet, giving you free publicity for your product. I think both parties could benefit from such a license.
This is quite possible. As I said, we do not need money in all cases. Publicity is more important. We think a bug in our product must be fixed regardless of whether the user who has encountered is a paying customer. So in fact we do provide support to all users, the differences are in priority, responce times, escalation level, etc.
|
|
|
|
|