Severe performance problem with 2 instances of web player

The nature of this discussion has gone beyond the scope of the Q&A format, so I have created a forum topic to discuss it further. Please continue the discussion there. If & when we have a more conclusive answer I shall post it here.


I’m not sure if this is a question for Unity Answers or if it’s a bug report, but I thought I’d verify here before I submit a bug.

Basically we have a small unity build that acts as a small element on a web page (246x246 pixels). It’s neat and works beautifully and takes the whole website up a level. The idea is to have several of these scattered on each page. These are very simple small projects, basically replacing several static images with rotating 3D models.

When there was only one instance of the unity web player on the page, the performance was reasonable. However once I introduced a second one, we got a huge performance problem all of a sudden.

The problem occurs when scrolling the browser window. When not scrolling both instances seem to perform reasonably and CPU usage is reasonable. If scrolling slowly the scrolling is choppy and there are many small freezes. When scrolling fast the CPU usage goes through the roof and the browser hangs or crashes.

I tried Flash instead, so exact two scenes exported to Flash placed in the exact same places on the page (2 instances) - performance wasn’t perfect but there were not huge CPU usage spikes or hangs. I’ve tried removing all JS from the page (hardcoded the embedded HTML result) - no difference.

So is there some known problem / is it likely something in our project ? Or is this likely to be some bug in Unity?

OK I think something is very wrong here… I just performed a very simple check and the results are frightening. I created a very simple project with a simple spinning cube, built it as a web player and uploaded to a little test page I created.

The result is that with 1 instance the browsers sort of perform reasonably. Scrolling is choppy but they survive.

However with 4 instances of the player on the page, when using the mouse to scroll, FF 3.6 and IE 8 perform badly but barely hang in there. Chrome (17.0.963.78 m) totally hangs. In fact I couldn’t even begin to scroll the page in Chrome, it didn’t respond.

I have uploaded the test to my server so that perhaps other people can try it and report the performance they are getting. I will also submit this as a bug report to the Unity team now.

Warning: This test can cause your browser to hang! Before you click this link make sure any work you have open in your browser is saved!

Unity Web Player Test

I’ve tested both versions without major problems. The one-player-version runs fine. The four-player-version also runs fine, but when scrolling it gets a little bit choppy, but not too bad. CPU usage usually is around 1-2% but when scrolling it raises to 35-40%. I have a quite old PC (Pentium D dual core 3GHz, 4GB ram, Nvidia 8600 GTS [256MB i guess :D], 32Bit-WindowsXP, FF 4.0 [i don’t use FF’s plugin-container!] )

I would expect a little hiccup due to device-context-repositioning. Since Unity is hardware accelerated, every plugin uses a hardware device context which isn’t made for being moved around :wink:

I have updated the test page to include a 12-instances page, and also started a results table based on the reports submitted here.

Click here to go to the test page.

The nature of this discussion has gone beyond the scope of the Q&A format, so I have created a forum topic to discuss it further. Please continue the discussion there. If & when we have a more conclusive answer I shall post it here.