mirror of
https://github.com/luau-lang/rfcs.git
synced 2025-05-04 10:43:48 +01:00
removed conf link
Signed-off-by: Dibri Nsofor <dnsofor@roblox.com>
This commit is contained in:
parent
5022cf2fd8
commit
9586170ab9
1 changed files with 2 additions and 2 deletions
|
@ -11,12 +11,13 @@ Luau's bytecode compiler (or VM?) is smart about inlining functions. We would ra
|
|||
Whether the goal is to improve instruction locality or perform context specific optimizations, <!-- force the compiler to optimize the function body in specific contexts --> function inlining can be a great resource for developers. Thankfully with the `-02` switch, Luau is able to automatically decide if code deserves to be inlined and optimize the code accordingly. To the best of our knowledge, exposing this to users directly could do more harm than good. Not only do these use cases only cater to a tiny subset of the language's users, it exposes our bytecode compiler to FILL when the larger subset who may not have a working understanding of the compiler adopts it.
|
||||
|
||||
```luau
|
||||
@inline -- does not exist
|
||||
@inline
|
||||
local function sum(lst: {[number]})
|
||||
if #lst == 0 then
|
||||
return 0
|
||||
else
|
||||
return lst[1] + sum(lst) -- bad rec
|
||||
end
|
||||
end
|
||||
|
||||
local s = sum({1, 2, 3})
|
||||
|
@ -35,6 +36,5 @@ None (yet).
|
|||
None (yet).
|
||||
|
||||
## Alternatives
|
||||
<!-- copied from: https://roblox.atlassian.net/wiki/spaces/Client/pages/1542170530/VM+Roadmap+2021#VMRoadmap2021-Debugger -->
|
||||
Prior to now, the team has considered some designs to make function inlining work effectively in Luau and is still hopeful that this may be possible sometime in the future. Till then, we suggest opening github issues with code samples of legitimate cases that we can use to further improve Luau's automatic (function inlining and unrolling) optimizations.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue