mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 01:49:19 +00:00
[MIRROR] Adds a note about for loop speed (#5267)
* Merge pull request #35154 from Iamgoofball/patch-387 Adds a note about for loop speed * Adds a note about for loop speed
This commit is contained in:
committed by
Poojawa
parent
b0b0c516ab
commit
8a3fed5509
6
.github/CONTRIBUTING.md
vendored
6
.github/CONTRIBUTING.md
vendored
@@ -306,6 +306,12 @@ Like all languages, Dream Maker has its quirks, some of them are beneficial to u
|
||||
|
||||
HOWEVER, if either ```some_value``` or ```i``` changes within the body of the for (underneath the ```for(...)``` header) or if you are looping over a list AND changing the length of the list then you can NOT use this type of for-loop!
|
||||
|
||||
### for(var/A in list) VS for(var/i in 1 to list.len)
|
||||
The former is faster than the latter, as shown by the following profile results:
|
||||
https://file.house/zy7H.png
|
||||
Code used for the test in a readable format:
|
||||
https://pastebin.com/w50uERkG
|
||||
|
||||
|
||||
#### Istypeless for loops
|
||||
A name for a differing syntax for writing for-each style loops in DM. It's NOT DM's standard syntax, hence why this is considered a quirk. Take a look at this:
|
||||
|
||||
Reference in New Issue
Block a user