Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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  
  Performance Hit.  (Read 3741 times)
0 Members and 1 Guest are viewing this topic.
Offline Username

Junior Newbie





« Posted 2006-02-09 21:04:57 »

I have a program that repeatedly invokes "sun.java2d.loops.GraphicsPrimitiveMgr$2.compare(object, object)" - millions of times.  The program uses custom painted components and at times uses BufferedImages of  TYPE_4BYTE_ABGR, and uses transparent colors.  The methods that paint the components are not invoked many times, yet this "sun.java2d.loops.GraphicsPrimitiveMgr$2.compare(object, object)" method is constantly invoked.
Please help with ideas.
Offline Jeff

JGO Coder




Got any cats?


« Reply #1 - Posted 2006-02-10 02:16:14 »

Um are you invoking that method directly yourself?

if so then dont.  Nothing in the sun.* packages are intended to be called directly by user code.

If this is the result of a performance trace of normal Java code then please give us the entire trace to see what is being called and why.

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
Offline Username

Junior Newbie





« Reply #2 - Posted 2006-02-10 09:59:19 »

no I am not invoking them myself.  They are being invoked somewhere in the Java2D implmentation.  There was a previous post about this in the forum at: http://www.java-gaming.org/forums/index.php?topic=2396.msg22655#msg22655 but with no solution.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline trembovetski

Senior Member




If only I knew what I'm talking about!


« Reply #3 - Posted 2006-02-11 07:50:46 »

I have a program that repeatedly invokes "sun.java2d.loops.GraphicsPrimitiveMgr$2.compare(object, object)" - millions of times.  The program uses custom painted components and at times uses BufferedImages of  TYPE_4BYTE_ABGR, and uses transparent colors.  The methods that paint the components are not invoked many times, yet this "sun.java2d.loops.GraphicsPrimitiveMgr$2.compare(object, object)" method is constantly invoked.
Please help with ideas.

Whatever performance hit you're seeing is not because of the GraphicsPrimitiveMgr.compare() calls
but because of the unusual image type you're using. We don't have many loops for this type,
so we have to convert it to an intermediate image of type INT_ARGB first and then one more time INT_ARGB to the destination type.

Do you really need this image type? INT_ARGB will be much faster. Also, if you don't need translucency,
INT_RGB will be even better.

Thanks,
  Dmitri
Offline Username

Junior Newbie





« Reply #4 - Posted 2006-02-12 13:39:50 »

I changed the type to    TYPE_INT_ARGB but the result is the same.  The application is still slow and uses up 90% of my CPU.  All I am doing is painting a custom component into a BufferedImage, and then painting the buffered image out to the graphics context using Graphics2D.paintImage().
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2006-02-13 12:01:47 »

That's because painting to BufferedImages is reasonably likely to not be hardware accelerated, and paintng BufferedImages to video graphics contexts is also reasonably likelt to not be hardware accelerated. You should consider using createCompatibleImage at least to get your graphics in the correct format for the destination graphics context.

Cas Smiley

Offline Username

Junior Newbie





« Reply #6 - Posted 2006-02-15 17:51:33 »

That's because painting to BufferedImages is reasonably likely to not be hardware accelerated, and paintng BufferedImages to video graphics contexts is also reasonably likelt to not be hardware accelerated. You should consider using createCompatibleImage at least to get your graphics in the correct format for the destination graphics context.

Cas Smiley

I tried that but it didn't work.  I however, did find the problem.  I was asking the custom component's parent to repaint itself after I finished painting the custom component.  This caused an implicit loop since the parent's repainting caused all of its children to be repainted.
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2006-02-16 12:44:59 »

I'd still bear my suggestion in mind as it can make your graphics paint an order of magnitude faster.

Cas Smiley

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

Riven (4 views)
2014-07-29 12:53:52

Dwinin (7 views)
2014-07-29 10:59:34

E.R. Fleming (20 views)
2014-07-29 03:07:13

E.R. Fleming (8 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (51 views)
2014-07-17 23:47:54
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!