From 540a3e69e71d1066ee923deeedcd776b46a529e1 Mon Sep 17 00:00:00 2001 From: Sainan Date: Fri, 16 Feb 2024 04:02:54 +0100 Subject: [PATCH] Remove for loop optimization --- docs/Optimizations/For Loops.md | 12 ------------ docs/QoL Improvements/Generalized Iteration.md | 1 - 2 files changed, 13 deletions(-) delete mode 100644 docs/Optimizations/For Loops.md diff --git a/docs/Optimizations/For Loops.md b/docs/Optimizations/For Loops.md deleted file mode 100644 index 98afc5103..000000000 --- a/docs/Optimizations/For Loops.md +++ /dev/null @@ -1,12 +0,0 @@ -The `pairs` and `ipairs` functions are optimized in Pluto. On a consistent basis, `pairs` & `ipairs` loops are **3.5x** faster than their Lua counterparts. - -## How does it work? -It doesn't operate under all circumstances though, the state of the iterator is stored in the to-be-closed variable returned by these functions, which is the last variable they give. If you interact or modify this variable, then the optimization won't occur. -``` -pairs: next, table, nil, nil -ipairs: ipairsaux, table, integer, nil -``` -As long as you don't access the last `nil` value, you're fine. -:::info -This optimization was published and implemented entirely by Xmelia Hermit. -::: diff --git a/docs/QoL Improvements/Generalized Iteration.md b/docs/QoL Improvements/Generalized Iteration.md index 375c5d929..0b87fbf06 100644 --- a/docs/QoL Improvements/Generalized Iteration.md +++ b/docs/QoL Improvements/Generalized Iteration.md @@ -12,7 +12,6 @@ for key, value in next(t) do print(key, value) end ``` -This is compatible with for-loop optimizations. :::caution The bytecode of this feature is not backwards-compatible with Lua.