Ruby 3.1 introduces Variable Width Allocation for Strings | Saeloun Blog
21-Apr-2022 1298
This post is in continuation of part 1 and in this blog, we will take a deeper look at how Variable Width Allocation works and how it can improve Ruby’s memory performance. Before getting into the VWA let us understand how large objects get allocated on Heap.Large objects on the HeapAs we know the size of the slot is 40 bytes, in which only 24 bytes are used for storing content. The rest of the 16 bytes are used for storing the flag and the pointer to other RVALUE. Now let us look at the example in which we need to allocate a string of 12 bytes and 37 bytes-.
Ruby 3.1 introduces Variable Width Allocation for Strings | Saeloun Blog #ruby #rubydeveloper #rubyonrails #introduces #Variable #Width #Allocation #Strings #Saeloun #blog https://rubyonrails.ba/link/ruby-3-1-introduces-variable-width-allocation-for-strings-saeloun-blog