yew icon indicating copy to clipboard operation
yew copied to clipboard

Refactor of examples/game_of_life

Open jesper-olsen opened this issue 1 year ago • 1 comments

Description

Refactor of examples/game_of_life as follows:

  1. Moved conway grid logic from main.rs to cell.rs - to better separate model & yew code.
  2. Renamed cell.rs to conway.rs
  3. Simplified and removed some codeblocks - e.g. directly count neighbours, instead of retuning them so that they can be counted...

Functionality is unchanged, LOC is reduced from 282 to 210 (~25%).

Fixes #0000

Checklist

  • [x] I have reviewed my own code
  • [ ] I have added tests

jesper-olsen avatar Feb 04 '24 02:02 jesper-olsen

Size Comparison

examples master (KB) pull request (KB) diff (KB) diff (%)
async_clock 102.006 102.006 0 0.000%
boids 175.728 175.728 0 0.000%
communication_child_to_parent 94.526 94.526 0 0.000%
communication_grandchild_with_grandparent 107.470 107.470 0 0.000%
communication_grandparent_to_grandchild 102.744 102.744 0 0.000%
communication_parent_to_child 90.881 90.881 0 0.000%
contexts 107.571 107.571 0 0.000%
counter 87.850 87.850 0 0.000%
counter_functional 88.238 88.238 0 0.000%
dyn_create_destroy_apps 90.744 90.744 0 0.000%
file_upload 101.674 101.674 0 0.000%
function_memory_game 174.516 174.516 0 0.000%
function_router 351.228 351.228 0 0.000%
function_todomvc 163.154 163.154 0 0.000%
futures 231.769 231.769 0 0.000%
game_of_life 112.119 111.677 -0.442 -0.395%
immutable 189.780 189.780 0 0.000%
inner_html 81.536 81.536 0 0.000%
js_callback 111.297 111.297 0 0.000%
keyed_list 201.004 201.004 0 0.000%
mount_point 84.424 84.424 0 0.000%
nested_list 115.850 115.850 0 0.000%
node_refs 92.000 92.000 0 0.000%
password_strength 1753.896 1753.896 0 0.000%
portals 95.202 95.202 0 0.000%
router 320.293 320.293 0 0.000%
simple_ssr 142.319 142.319 0 0.000%
ssr_router 389.602 389.602 0 0.000%
suspense 117.522 117.522 0 0.000%
timer 90.345 90.345 0 0.000%
timer_functional 99.719 99.719 0 0.000%
todomvc 143.458 143.458 0 0.000%
two_apps 87.535 87.535 0 0.000%
web_worker_fib 136.750 136.750 0 0.000%
web_worker_prime 187.137 187.137 0 0.000%
webgl 84.146 84.146 0 0.000%

✅ None of the examples has changed their size significantly.

github-actions[bot] avatar Feb 04 '24 02:02 github-actions[bot]