Turn slow mode into fast mode #68

Merged
merged 4 commits into from Jan 20, 2012

Conversation

Projects
None yet
2 participants
Contributor

bilts commented Jan 20, 2012

This fixes several major UI inefficiencies:

 * playWeb.coffee triggered output updates that were being suppressed by play.html
   I removed these.  The output updates less frequently and is completely
   controlled by play.html.  Eventually, all of the CoffeeScript in play.html should
   be merged with playWeb.coffee, but that's a different issue.
 * We were calling zeroTimeout very frequently.  zeroTimeout is fast, but not
   free.  We now call it approximately 4 times a second, enough to keep the browser
   from timing out, but not enough to cause noticeable performance overhead.
 * We had released control back to the browser based on the number of games played.
   We also updated the graphs based on the number of games played.  Doing this
   way, we needed to be pessimistic about AI and browser performance.  We now
   release control when a game is over and we've had control for more than .25s.
 * We were updating the DOM whenever we added a page to the log, even when we
   updated "quietly" because we updated the paginator.  We now detect if the
   pagination has changed before updating it.

Combined, these changes allow the "slow mode" simulations to run nearly as fast
as the fast mode.  In Firefox, the UI updates in slow mode cause about 10%
runtime overhead.  Because of this, I removed the fast mode checkbox.

Fixes #23

bilts added some commits Jan 14, 2012

@bilts bilts Avoid refreshing turn logs when they're not visible
Repeatedly running games takes about 1/3 less time when we use this optimization step.  See Issue #23.
4fcc865
@bilts bilts Avoid some unnecessary overhead in AI choice function. b456d46
@bilts bilts Log the time spent playing a3e7855
@bilts bilts Turn slow mode into fast mode
This fixes several major UI inefficiencies:

 * playWeb.coffee triggered output updates that were being suppressed by play.html
   I removed these.  The output updates less frequently and is completely
   controlled by play.html.  Eventually, all of the CoffeeScript in play.html should
   be merged with playWeb.coffee, but that's a different issue.
 * We were calling zeroTimeout very frequently.  zeroTimeout is fast, but not
   free.  We now call it approximately 4 times a second, enough to keep the browser
   from timing out, but not enough to cause noticeable performance overhead.
 * We had released control back to the browser based on the number of games played.
   We also updated the graphs based on the number of games played.  Doing this
   way, we needed to be pessimistic about AI and browser performance.  We now
   release control when a game is over and we've had control for more than .25s.
 * We were updating the DOM whenever we added a page to the log, even when we
   updated "quietly" because we updated the paginator.  We now detect if the
   pagination has changed before updating it.

Combined, these changes allow the "slow mode" simulations to run nearly as fast
as the fast mode.  In Firefox, the UI updates in slow mode cause about 10%
runtime overhead.  Because of this, I removed the fast mode checkbox.

Fixes #23
b51bf28

@rspeer rspeer added a commit that referenced this pull request Jan 20, 2012

@rspeer rspeer Merge pull request #68 from bilts/performance
Turn slow mode into fast mode
a99d12a

@rspeer rspeer merged commit a99d12a into rspeer:master Jan 20, 2012

Owner

rspeer commented Jan 20, 2012

Thanks for all the fixes! I'm a bit low on time so I haven't checked all the code, but it sounds like you know what you're doing, so I've merged them all. Of course keep me updated if this makes something go wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment