Performance difference between app and applet is enormous for a game.

4 views
Skip to first unread message

Jonathan Chung

unread,
Mar 30, 2010, 11:26:38 PM3/30/10
to PulpCore
This is more of a general question and probably not related at all to
PulpCore.

One of my users has created a rather sophisticated game. It plays
beautifully in PulpCore player (60 FPS), but when played inside an
applet, regardless of whether the applet is online or played locally,
performance is atrocious.

What sort of differences could there be between playing inside a
desktop application versus playing inside the browser that could lead
to such a performance disparity?

David Brackeen

unread,
Mar 30, 2010, 11:43:11 PM3/30/10
to pulp...@googlegroups.com
I couldn't say. Never seen anything like that. Try running Xprof.
Or provide OS/Browser info, and a link to the applet so others can try it out.


--
You received this message because you are subscribed to the Google Groups "PulpCore" group.
To post to this group, send email to pulp...@googlegroups.com.
To unsubscribe from this group, send email to pulpcore+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pulpcore?hl=en.


Chris Colman

unread,
Mar 31, 2010, 12:21:01 AM3/31/10
to pulp...@googlegroups.com
What version of the JRE has he got loaded?

Maybe he has a *really* old JRE where the hotspot optimization isn't
that good whereas he might have a more recent JDK/JRE in his path that
is used when he runs it as an application. More recent 1.6 versions tend
to have much better hotspot optimization and optimized networking and
threading - not sure if the app is using those.

Regards,
Chris Colman
http://pagebloom.com

Nouknouk

unread,
Mar 31, 2010, 3:38:01 AM3/31/10
to pulp...@googlegroups.com
Hi,

just an idea among other: the amount of memory available in an applet
environment is far smaller than in a 'desktop JRE' environment.
Maybe It has an impact if the applet is memory consuming, because having
few memory prompts the garbage collector to run more often in 'applet JRE'

Regards,


Nouk�

Le 31/03/2010 05:26, Jonathan Chung a �crit :

John C. Turnbull

unread,
Mar 31, 2010, 4:52:51 AM3/31/10
to pulp...@googlegroups.com
I did an analysis about a year ago using the latest JRE at the time and
discovered that even when using applet parameters to set the exact same
amount of available heap to both an applet and an application, the applet
code would still perform about 30-40% slower than the application code. No
one could explain why and even Dmitri Trembovetski (who was working at Sun
at the time) was unaware of the difference or its cause.

Applets will always be slower than applications for reasons unknown and, as
discovered, it seems that rendering is more affected than other types of
operations.

-JCT

-----Original Message-----
From: pulp...@googlegroups.com [mailto:pulp...@googlegroups.com] On Behalf
Of Nouknouk
Sent: Wednesday, 31 March 2010 18:38
To: pulp...@googlegroups.com
Subject: Re: Performance difference between app and applet is enormous for a
game.

Hi,

just an idea among other: the amount of memory available in an applet
environment is far smaller than in a 'desktop JRE' environment.
Maybe It has an impact if the applet is memory consuming, because having
few memory prompts the garbage collector to run more often in 'applet JRE'

Regards,


Nouk²

Le 31/03/2010 05:26, Jonathan Chung a écrit :
> This is more of a general question and probably not related at all to
> PulpCore.
>
> One of my users has created a rather sophisticated game. It plays
> beautifully in PulpCore player (60 FPS), but when played inside an
> applet, regardless of whether the applet is online or played locally,
> performance is atrocious.
>
> What sort of differences could there be between playing inside a
> desktop application versus playing inside the browser that could lead
> to such a performance disparity?
>
>

--

David Brackeen

unread,
Mar 31, 2010, 10:51:42 AM3/31/10
to pulp...@googlegroups.com
I agree, it's probably the smaller heap.
Hit ctrl-I and look at the heap usage.

On Wed, Mar 31, 2010 at 12:38 AM, Nouknouk <nouk...@gmail.com> wrote:
Hi,

just an idea among other: the amount of memory available in an applet environment is far smaller than in a 'desktop JRE' environment.
Maybe It has an impact if the applet is memory consuming, because having few memory prompts the garbage collector to run more often in 'applet JRE'

Regards,


Nouk²

Le 31/03/2010 05:26, Jonathan Chung a écrit :

This is more of a general question and probably not related at all to
PulpCore.

One of my users has created a rather sophisticated game. It plays
beautifully in PulpCore player (60 FPS), but when played inside an
applet, regardless of whether the applet is online or played locally,
performance is atrocious.

What sort of differences could there be between playing inside a
desktop application versus playing inside the browser that could lead
to such a performance disparity?

 

Jonathan Chung

unread,
Mar 31, 2010, 12:15:40 PM3/31/10
to PulpCore
- I see the same problem as he does. I'll peek at the heap, but I
recall that I do have it set higher for applets.

- Applet is here:
http://stencyl.com/prototype/play_verus.php

- Example of an unaffected applet:
http://stencyl.com/prototype/play_gourd.php

(Request: DO NOT CLICK THE FB / TWEET BUTTONS ON THESE PAGES)


On Mar 31, 7:51 am, David Brackeen <brack...@gmail.com> wrote:
> I agree, it's probably the smaller heap.
> Hit ctrl-I and look at the heap usage.
>

> On Wed, Mar 31, 2010 at 12:38 AM, Nouknouk <noukn...@gmail.com> wrote:
> > Hi,
>
> > just an idea among other: the amount of memory available in an applet
> > environment is far smaller than in a 'desktop JRE' environment.
> > Maybe It has an impact if the applet is memory consuming, because having
> > few memory prompts the garbage collector to run more often in 'applet JRE'
>
> > Regards,
>
> > Nouk²
>
> > Le 31/03/2010 05:26, Jonathan Chung a écrit :
>
> >  This is more of a general question and probably not related at all to
> >> PulpCore.
>
> >> One of my users has created a rather sophisticated game. It plays
> >> beautifully in PulpCore player (60 FPS), but when played inside an
> >> applet, regardless of whether the applet is online or played locally,
> >> performance is atrocious.
>
> >> What sort of differences could there be between playing inside a
> >> desktop application versus playing inside the browser that could lead
> >> to such a performance disparity?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "PulpCore" group.
> > To post to this group, send email to pulp...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > pulpcore+u...@googlegroups.com<pulpcore%2Bunsu...@googlegroups.com>

Jonathan Chung

unread,
Mar 31, 2010, 12:19:24 PM3/31/10
to PulpCore
Ah, I forgot - this is really intuitive for a start button, but you
need to hit S to get past the title screen.

Jonathan Chung

unread,
Apr 1, 2010, 2:25:02 AM4/1/10
to PulpCore
(Typo in above post - I meant unintuitive!)

I did some poking around and found the memory usage to be well below
the allocated amount (29M still free), so it seems like the thrashing
theory isn't the case here.

Troy Cox

unread,
Apr 1, 2010, 9:16:57 PM4/1/10
to PulpCore
I'm not sure what slow is, but I don't experience any lag of any kind.
All the graphics are fluid, and the music is without glitch.
Really weird interface. The miniature guy is an interesting twist.

java build 1.6.0_19-b04
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/
20100115 Firefox/3.6 (.NET CLR 3.5.30729)
AMD Athlon 64x2dual 3800+ 2.01ghz, 3gb

I pressed CTRL+ i but couldn't get info on the actual frame rate.

So I pulled out my macbookpro. It ran exactly the same.
Smooth and no glitches.

OSX 10.6.2
2.53 ghz intel core 2 duo
4gb 1067 mhz ddr3
Java 1.6.0_17
Java SE Runtime Env (build 1.6.0_17-b04-248-10m3025
Java HotSpot 64-Bit Server VM (build 14.3-b01-101, mixed mode)

I know this isn't much help for me to not see a problem with the game,
other than the applet size and the weird controls.
But maybe it can help you eliminate something.

When you say performance is atrocious, do you mean it is jumpy and
slow?
I didn't see any of that. If you mean you have a much slower frame
rate, I didn't see a problem. But, I don't know the frame rate I had.

You do know that Saturday morning cartoons are very watchable at 12
frames per sec. And movies run at 24 fps. ;)
If your game play is affected (which I didn't experience), then fps
shouldn't be used as the timing delta.

-Troy

Jonathan Chung

unread,
Apr 1, 2010, 9:49:09 PM4/1/10
to PulpCore
Atrocious as in < 10 FPS, playing like a flipbook slideshow. Not one
person among us was able to get a playable framerate.

On the other hand, the other game ran fine for all testers who tried
it, but David said that it was equally choppy for him and said
something about it GC'ing every 2 seconds.

Troy Cox

unread,
Apr 2, 2010, 12:03:17 AM4/2/10
to PulpCore
What is the cache setting for temporary files in the java control
panel?
java control panel/General tab/Temporary Internet Files/Settings/
compression for JAR files = 'None'
space for temp files = 1000 mb
Those are my settings (mostly for jnlp to play well).
Don't know if it could affect applets.

I captured my game play with camtasia here:
http://getgamesforfree.com/image.php?image=http%3A//getgamesforfree.com/pulpcore/verusPulpcoreGame/verusPulpcoreGame.flv

That's just a link to a video streamer on my game site.

Jonathan Chung

unread,
Apr 2, 2010, 11:49:01 PM4/2/10
to PulpCore
Though this could be the recording overhead, what you posted isn't how
the game, if played as an app (inside Pulpcore Player) plays klike -
it runs at a buttery smooth 60 FPS, even with 2x scaling.

My settings are the same as yours.

On Apr 1, 9:03 pm, Troy Cox <troylee...@gmail.com> wrote:
> What is the cache setting for temporary files in the java control
> panel?
> java control panel/General tab/Temporary Internet Files/Settings/
> compression for JAR files = 'None'
> space for temp files = 1000 mb
> Those are my settings (mostly for jnlp to play well).
> Don't know if it could affect applets.
>

> I captured my game play with camtasia here:http://getgamesforfree.com/image.php?image=http%3A//getgamesforfree.c...

Jonathan Chung

unread,
Apr 3, 2010, 1:29:39 PM4/3/10
to PulpCore
The author was able to get things to a workable state with some logic
tweaks on his side. Seems like there's a tolerance range for applets,
and once you pass that, the framerate goes down the toilet.

If you visit the Verus page again, the framerate should be much
better, if not 60 FPS.

Thanks to everybody for looking into this!

Reply all
Reply to author
Forward
0 new messages