Note about GC in hot path in coding conventions

This commit is contained in:
vis2k 2019-02-24 22:34:10 +01:00
parent 5e09d13d6e
commit f5044e0b44

View File

@ -110,8 +110,8 @@ Start reading our code and you'll get the hang of it. We optimize for readabilit
* **KISS / Occam's Razor** - always use the most simple solution. * **KISS / Occam's Razor** - always use the most simple solution.
* **No Premature Optimizations** * **No Premature Optimizations**
MMOs need to run for weeks without issues or exploits. MMOs need to run for weeks without issues or exploits.
If you want your code to run 1% faster, spend \$100 on a better CPU. Only do GC optimizations and caching in hot path. Avoid it everywhere else to keep the code simple.
* **Curly Braces { }** * **Curly Braces { }**
Always use braces even for one line if's. Unity did this everywhere, and there is value in not accidentally missing a line in an if statement because there were no braces. Always use braces even for one line if's. Unity did this everywhere, and there is value in not accidentally missing a line in an if statement because there were no braces.
* **Variable naming** * **Variable naming**
\`NetworkIdentity identity\`, not \`NetworkIdentity uv\` or similar. If the variable needs a comment the name needs to be changed. For example, `msg = ... // the message` use `message = ...` without a comment instead \`NetworkIdentity identity\`, not \`NetworkIdentity uv\` or similar. If the variable needs a comment the name needs to be changed. For example, `msg = ... // the message` use `message = ...` without a comment instead