This topic was automatically opened after 10 minutes.
This has been bothering me for god-knows-how long, Iâm so glad itâs finally supported now! Great to see all the optimizations too - I found it surprising how much I care about micro-optimizations, when in reality they (usually) only matter in really performance-intensive code, lol.
This could be massive. This syntax used to put the index in the hash portion of the table which would add overhead. From my very limited testing this seems to slap these down in the array portion. The optimization is the least important part. next
, at least in vanilla Lua, prioritizes the array portion of the table before moving to the hashmap to iterate, and it does it in order. Even though this behavior isnât defined, this change makes it so tables created with explicit numeric indices can be iterated on in order with pairs
and next
.
more room for me to be lazy
Yup, you are correct on both counts.
WHAT
WHAT
WHAT
yâall had me screaming in class .
WE HAVE GENERIC FUNCTIONS AGAIN WOOOOOOHOOOOOOO
THIS IS HUUUUUUGE
(p.s. thank you! <3)
Something I want to report, Luauâs script editor at the moment thinks having (...) -> ()
as a function definition is valid, which it isnât, as you need to specify the type of the arguments (...any) -> ()
.
It throws out an error, but the editor doesnât seem to think it is invalid code.
Did this improve Vector3 math as well, since it creates new Vector3s?
No, it was already using an optimal construction path, this only refers to explicit calls to Vector3.new
You love to see it.
Is there any updates on type-checking being taken into account by the code compiler and providing a performance boost for games?
Not yet, sorry!
This requires analyzing our type system for whatâs called soundness - specifically, augmenting the type engine with extra information about when itâs basically 100% confident in the type vs where the type may be a lie, such as due to use of ::
. Right now weâre fully focused on making sure that the type checking core is robust, helpful wrt inference results, and more unified between nonstrict and strict modes, as right now the type inference engine makes very different decisions between these two modes. Only after this work is done will we be able to start looking at soundness properties of our type system.
Additionally, the exact knowledge of types in practice can help us in two ways:
- Advanced compiler optimizations, such as being able to reuse computations between different parts of the code when we know the exact types
- Just in time compilation, where the extra overhead for checking the types, which is comparatively small in the interpreter, becomes comparatively large.
We arenât doing these yet⌠but we plan to! So stay tuned but give us time, nothing in this realm will ship this year.
Hey, I got a sneak peak of this bidirectional type inference feature and found a major bug with it which I was unfortunately too busy to create a bug report about before this announcement. Hopefully this can be fixed easily without too much hassle? I love the bidirectional typing, and itâs easy to work around this bug by either annotating all parameters, or annotating none of them.
EDIT: See Bidirectional Typing gets borked when annotating some but not all parameters in a callback for a public bug report
An optimization to closure allocation was released a few weeks back that affected closures without upvalues. Last week, it was further enhanced to closures with upvalues:
Is there any way we can know what the âcomplex microarchitectural conditionsâ are? This optimization, while effective, seems risky in some ways (mostly when combined with setfenv
), and it would be nice to know what the conditions are to avoid running into issues.
This optimization is currently only active in Studio and waiting for mobile updates for us to fully test on live games. In the next recap we should know if itâs good enough to stay or not, and subsequently weâll release more information. However itâs important to know that, if that optimization stays, we wonât promise that the conditions for when it activates are set in stone (they may change in the future).
The interaction with setfenv
can be very roughly summarized as âif setfenv
is used with a new table before the closure is created, the closure allocation will not be elidedâ.
Iâve replied in the bug report topic, but for visibility here:
Weâre going to disable bidirectional type inference for function arguments until the fix is released.
Sorry if I sound dumb here,
This is something Iâve been wondering for a while,
Apparently Lua has some issues with specifying a number index on the table constructor, on which that index will be stored in the hash part instead, even if everything inside that table constructor is in order and shaped exactly like an array.
Is this optimization about that? If not, I was wondering if this was ever changed in Luau?
Answer is yes, it has been answered in this very same post already:
Why doesnât this function work?
function assertValue<T>(a: T?): T
assert(a)
return a
end
It should work.
Do you have Studio version 500?
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.