[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Performance problem with 0-based arrays
- From: "Jasper Klein" <jasper@...>
- Date: Tue, 24 Nov 2020 22:34:46 +0100
Op Tue, 24 Nov 2020 21:55:11 +0100 schreef Egor Skriptunoff <firstname.lastname@example.org>:
Perhaps it’s again time to consider adding table.new?
It would be nice to have a function like
table.rebuild( [ t, ] min_array_size, min_hash_size)
which sets size constraints and shrinks the table.
I keep quoting myself. :)
In C++ you can reserve space for n elements in a vector or an unordered map/set.
Once I wrote a patch for 5.3* that added a table.reserve( t, narray, nhash ) function which reserves at least a number of array and hash elements. 
The result was that the improvement of the array part was negligible but for the hash part significant.
I couldn't find the benchmark anymore, probably it was removed during a virtual Marie Kondo cleanup.
* I think it was 5.3.5