Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've been doing some profiling today. Here's a sample of the data from an Epoch 7 save game I have here. Pretty close to worst case scenario, <em>and</em>, this is with pulsing off, so I'm starting to think maybe I can get away with the pulsing and the problem is elsewhere.</p> <pre><code>Function Calls Percent Own Time(ms) Time(ms) File mouseEvent() 658 4.69% 75.67 1596.14 GamesByEmail.js (line 4150) onmousemove 576 1.07% 17.32 1575.29 26 (line 1) mouseMove() 576 1.18% 19.04 933.05 Game.js (line 2122) findAtPoint() 576 4.14% 66.9 594.48 EmpiresT...ritory.js (line 415) containsPoint() 16217 6.00% 96.91 518.51 GamesByEmail.js (line 5676) normal() 16217 14.65% 236.61 421.59 Foundati...ometry.js (line 485) cancelScroll() 658 21.51% 347.38 347.38 GamesByEmail.js (line 4109) mouseMoveHidePrevious() 576 0.18% 2.94 266.65 Game.js (line 2153) updateMouseHtml()61 0.16% 2.64 256.51 Game.js (line 2178) updateMouseHtmlPosition() 639 11.69% 188.87 216.47 GamesByEmail.js (line 3783) setMouseHtml() 61 0.53% 8.58 206.75 GamesByEmail.js (line 3767) containsPoint() 16217 5.78% 93.41 144.65 Foundati...ometry.js (line 312) setInnerHtml() 61 1.99% 32.19 116.9 GamesByEmail.js (line 2578) toString() 183 6.40% 103.33 103.33 Foundation.js (line 476) washHtml() 61 0.10% 1.54 84.71 GamesByEmail.js (line 2566) insertStyleForElements() 122 0.40% 6.49 83.17 GamesByEmail.js (line 280) mousePoint() 578 2.57% 41.53 67.59 GamesByEmail.js (line 4119) containsXY() 16217 3.17% 51.24 51.24 Foundati...ometry.js (line 308) getElement() 1008 1.98% 31.98 41.18 Foundation.js (line 507) normal 16411 2.50% 40.34 40.34 Foundati...ometry.js (line 487) Point() 1155 1.88% 30.34 36.38 Foundati...ometry.js (line 15) canAttack() 614 0.30% 4.79 35.41 Empire.js (line 477) ... </code></pre> <p>What I'm seeing indicates all the time is eaten up inside mouseMove and its subfns. Determining which territory the mouse is over is normally an O(n) job. Iterate through each polygon of each territory until we find one containing the mouse X,Y. (things like "normal()" are a part of that process. It uses bounding boxes too, so some optimization there).</p> <p>But I don't understand how this performance can become so much worse at the end of the game (with lots of territory overlays) versus the start of the game with very few territory overlays. Searching through the territories to determine which one the mouse is in might not itself be the problem... but some side-effect that gets incurred while doing this, OR, that browsers on Linux and Mac are getting overwhelmed by the volume of DOM elements created by having so many tiny images onscreen(?) </p> <p>Guestimate of images onscreen:</p> <ul> <li>maybe 120 images for coloured territories</li> <li>another 130 or so for highlighted territories</li> <li>the "pieces.gif" sprited to show monuments, cities and army guys, another 240+ of those</li> </ul> <p>That alone is about 500 gifs onscreen at once, or 250gifs and 1 gif sprited 240 times</p> <p>This suggests either myself of the underlying API is doing something really expensive when a territory has a coloured overlay. (because at the dawn of history performance is pretty good when mousing around the board).</p> <p>Could be I have to review all the code inside territory.updateHtml(); (who was it that said this wasn't a code question?... ha! I don't think he's seen the 15000 lines of spaghetti madness javascript I've written :o ).</p> <p>Maybe I should run a similar profile run from Epoch 1 to see what that looks like? I'll post if I find out more.</p> <p>Troy</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload