glslViewer icon indicating copy to clipboard operation
glslViewer copied to clipboard

sandbox: Condensed `renderUI` + fellow subsections

Open tcoyvwac opened this issue 2 years ago • 2 comments

  • Reduced renderUI code-size in sandbox.
  • Refactored to use standard library algorithms and some dispatch-(v)-table techniques for readability.
    • This is to flatten the nested if-statements; reducing arrow-code.
    • Codebase being C++11 required dispatch-(v)-table technique.

tcoyvwac avatar Dec 25 '22 23:12 tcoyvwac

Happy to explain any parts of the changeset; also happy to rebase more if needed! :smile_cat:

This was a bit of a challenge as the codebase is currently strict C++11. Highly recommend my PR:#284 to reduce the pain! :sweat_smile: (PR:#284 passes all build CI so no problem right...?) :wink:

tcoyvwac avatar Dec 25 '22 23:12 tcoyvwac

Happy Holidays! Thanks so much for this PRs (and update on the previous one) together with the detailed explanation on way upgrading to C++20. Also I appreciate the working around C++11 issues in this PR! I will start reviewing it in this next days, apologize in advance for doing it slowly.

Question about goals and motivations, beside flattened the code for readability (and for making it less error prune by reducing the nested logic. Did you were able to perceive performance gains on execution time?

First impressions: I'm not familiar with dispatch-(v)-table. I will start studding it : ) . At first glance, I do appreciate how clean renderUI() becomes. Great job! I'm a bit concern of how easy will be to add/modify the rendered UI in the future (the UI and ncurses console at the moment are the most experimental ends because much end up being a matter of taste or convenience, and I find my self tweaking things here and there often), In terms of code size seams there is not a significant difference, but if I understand right, that's because you the need to work around strict c++11, right?. I must admit that at the light of the dispatch-(v)-table, my original code looks naive and silly : )

Once again, thank you!

patriciogonzalezvivo avatar Dec 26 '22 10:12 patriciogonzalezvivo