olistic / warriorjs

🏰 An exciting game of programming and Artificial Intelligence
https://warriorjs.com
MIT License
9.41k stars 489 forks source link

Optimize level and events #210

Closed olistic closed 6 years ago

olistic commented 6 years ago

Optimize shapes of level and play events, reducing the size of the payloads.

Version Level payload size Events payload size
v0.6.0 2K 41K
v0.7.0 2K 15K
This PR 1.1K 5K

Tests performed by JSON-stringifying the payloads when playing level 1 of beginner's tower.

This signifies a ~45% and ~88% reduction on the level payload size and the events payload size, respectively, based on version v0.6.0.

codecov-io commented 6 years ago

Codecov Report

Merging #210 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #210      +/-   ##
==========================================
+ Coverage   92.22%   92.23%   +<.01%     
==========================================
  Files          86       86              
  Lines        1068     1069       +1     
  Branches      176      173       -3     
==========================================
+ Hits          985      986       +1     
  Misses         68       68              
  Partials       15       15
Impacted Files Coverage Ξ”
packages/warriorjs-core/src/Logger.js 100% <ΓΈ> (ΓΈ) :arrow_up:
packages/warriorjs-core/src/Floor.js 100% <ΓΈ> (ΓΈ) :arrow_up:
packages/warriorjs-cli/src/utils/getLevelConfig.js 100% <ΓΈ> (ΓΈ) :arrow_up:
packages/warriorjs-core/src/Unit.js 100% <ΓΈ> (ΓΈ) :arrow_up:
packages/warriorjs-core/src/Space.js 100% <ΓΈ> (ΓΈ) :arrow_up:
packages/warriorjs-core/src/runLevel.js 100% <ΓΈ> (ΓΈ) :arrow_up:
packages/warriorjs-core/src/Warrior.js 100% <100%> (ΓΈ) :arrow_up:
...ackages/warriorjs-cli/src/ui/printWarriorStatus.js 100% <100%> (ΓΈ) :arrow_up:
packages/warriorjs-cli/src/ui/getUnitStyle.js 100% <100%> (ΓΈ) :arrow_up:
packages/warriorjs-core/src/loadLevel.js 89.28% <100%> (ΓΈ) :arrow_up:
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update 1cde47a...e27a5e3. Read the comment docs.