From 736e8a1d518cba3b2637daa9b1390db6852b8406 Mon Sep 17 00:00:00 2001 From: Vyacheslav Egorov Date: Mon, 3 May 2021 17:40:30 +0300 Subject: [PATCH] Finished April 2021 recap post --- .../2021-04-30-luau-recap-april-2021.md | 47 +++++++++++++++++-- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/docs/_posts/2021-04-30-luau-recap-april-2021.md b/docs/_posts/2021-04-30-luau-recap-april-2021.md index aa7d16be..23dfba61 100644 --- a/docs/_posts/2021-04-30-luau-recap-april-2021.md +++ b/docs/_posts/2021-04-30-luau-recap-april-2021.md @@ -3,18 +3,57 @@ layout: single title: "Luau Recap: April 2021" --- -Luau is our new language that you can read more about at [https://roblox.github.io/luau](https://roblox.github.io/luau). +Luau is our new language that you can read more about at [https://roblox.github.io/luau](https://roblox.github.io/luau). Another busy month in Luau with many performance and typechecking improvements. -[Cross-posted to the [Roblox Developer Forum](TBD).] +[Cross-posted to the [Roblox Developer Forum](https://devforum.roblox.com/t/luau-recap-april-2021/).] ## Features +Luau implementation now provides an API for type-aware autocomplete suggestions. + +Roblox Studio will be the first user of this API and we plan for a new beta feature to come soon in addition to existing Luau-powered beta features like Go To Declaration, Type Hovers and Script Function Filter (you should check those out!) + ## Typechecking improvements +We've made various improvements to the Luau typechecker: + +* Fixed an issue with `table.insert` function signature +* Made improvements to cyclic module import detection and error reporting +* Added new linter pass that will report uses of deprecated Roblox APIs +* Fixed `assert` function declaration to accept a second optional string argument +* Fixed incorrect error on modification of table intersection type fields +* When using an 'or' between a nillable type and a value, the resulting type is now inferred to be non-nil + +We have also made improvements to type output in error messages and made additional improvements to parser recovery from errors. + +As usual, typechecking improvements will not break execution of your games even if new errors get reported. + ## Performance improvements +Performance is a very important part of Luau implementation and we continue bringing in new performance optimizations: + +* We've finished the work on internal `vector` value type that will be used by `Vector3` type in Roblox. Improvements of up to 10x can be seen for primitive operations and some of our heavy `Vector3` benchmarks have seen 2-3x improvement. You can read more about this feature [on Roblox Developer forums](https://devforum.roblox.com/t/native-luau-vector3-beta/) +* By optimizing the way string buffers are handled internally, we bring improvements to string operations including `string.lower`, `string.upper`, `string.reverse`, `string.rep`, `table.concat` and string concatenation operator `..`. Biggest improvements can be seen on large strings +* Improved performance of `table.insert` and `table.remove`. Operations in the middle of large arrays can be multiple times faster with this change +* Improved performance of internal table resize which brings additional 30% speedup for `table.insert` +* Improved performance of checks for missing table fields +* Improved performance of table lookup with an index operator and a string: `t["name"]` + +## Generic functions + +We had to temporarily disable generic function definitions last month after finding critical issues in the implementation. + +While they are still not available, we are making steady progress on fixing those issues and making additional typechecking improvements to bring them back in. + ## Debugger improvements -## Library changes +Debugging is now supported for parallel Luau Actors in Roblox Studio. -## Coming soon... +Read more about the feature [on Roblox Developer forums](https://devforum.roblox.com/t/parallel-lua-beta/) and try it out yourself. + +## Behavior changes + +Backwards compatibility is very important for Luau, but sometimes a change is required to improve the language or performance. Even still, we try to keep impact of these changes to a minimum: + +* __eq tag method will always get called for table comparisons even when a table is compared to itself. +* assert function will return only the first argument as the result.