Viewing 1 post (of 1 total)
  • Author
    Posts
  • #6085
    peq42
    Keymaster

    Lua 5.5, the latest version of the popular lightweight scripting language, has been released today, five years after Lua 5.4. This update brings several improvements and refined features aimed at optimizing the language’s efficiency, especially in terms of memory usage and garbage collection (GC) enhancements. There were some pretty cool changes.

    Highlights of Lua 5.5 include:

    • Global variable declarations: It is now possible to explicitly declare global variables, which helps prevent common bugs related to the accidental creation of global variables.

    • Read-only for-loop variables: Variables used in for loops are now immutable, meaning they can only be read and not changed within the loop, increasing code safety and predictability.

    • Floating-point number printing: Floating-point numbers are printed in decimal with enough digits to ensure they can be read back accurately, improving precision when dealing with these numbers.

    • More levels for constructors: An increase in the number of allowed levels for constructors, enabling more complex data structures.

    • table.create function: A new function that allows the creation of tables with pre-allocated size, optimizing memory usage.

    • utf8.offset returns the final position of a character: The utf8.offset function has been improved to return the final position of a character, making UTF-8 string handling easier.

    • External strings support: Support for strings that use memory not managed by Lua, which is useful for integrations with other languages or systems.

    • New luaL_openselectedlibs and luaL_makeseed functions: Additional functions that provide more control over opening selected libraries and generating seeds for random numbers.

    • Garbage collection improvements: Introduction of a generational mode for the GC and performing major garbage collections incrementally, which improves performance and reduces latency.

    • More compact arrays: Large arrays now use about 60% less memory, a significant optimization for applications handling large datasets.

    • Dynamically loaded readline in lua.c: The command-line interpreter lua.c now dynamically loads the readline library, allowing for better compatibility and resource usage.

    • Static (fixed) binaries: When loading a binary chunk in memory, Lua can reuse its original memory in some internal structures, an optimization for embedded environments.

    • Dump and undump reuse all strings: The serialization and deserialization process now reuses strings, saving memory.

    • Auxiliary buffer reuses the buffer: When creating the final string, the auxiliary buffer reuses the buffer, enhancing efficiency.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.