NetLogo / Tortoise

Compiler and runtime engine for NetLogo models that runs in JavaScript 🐢
https://netlogoweb.org
Other
56 stars 27 forks source link

Agent set optimizations for `one-of` #204

Closed LaCuneta closed 6 years ago

LaCuneta commented 6 years ago

@qiemem reported the Rock Paper Scissors library model performed poorly in NetLogo Web. In checking, it was an issue with the one-of primitive being used in combination with large agent sets, specifically a large world patch set. The improvements should help speed up any model that uses one-of with agent sets, and especially so with larger agent-sets.

These changes have been reviewed by @TheBizzle already, I just wanted a place to post the optimization results for RPS. Qualitatively the model is also much more usable with the changes. Other model benchmarks showed no change, or more modest improvements.

Time:       08/09/2018 @ 12:40:00 PM CDT
Version:    e50ad8c-dirty
Models:     Rock Paper Scissors
Iterations: 20
Ticks:      200
Engines:    V8
Comment:    `one-of` pre-optimizations

Rock Paper Scissors (V8 Node.js v9.7.1):
--Average: 446.356 seconds
--Min:     439.326 seconds
--Max:     452.935 seconds

==========

Time:       08/09/2018 @ 12:22:52 PM CDT
Version:    8f627a5-dirty
Models:     Rock Paper Scissors
Iterations: 20
Ticks:      200
Engines:    V8
Comment:    `one-of` post-optimizations

Rock Paper Scissors (V8 Node.js v9.7.1):
--Average: 26.993 seconds
--Min:     26.285 seconds
--Max:     27.482 seconds