[Tarantool-patches] [PATCH v2 1/3] small: implement new size class evaluation

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu Dec 24 18:13:34 MSK 2020


Thanks for the fixes!

>> Lets omit unnecessary changes. This clearly has nothing to do with
>> the functional part of the patch.
> 1. Fixed

Nope, it is not. The diff hunk is still here.

>> I don't understand. So you can make the factor smaller than it was
>> requested? What is the point in configuring the factor then?
> 9. The user configures the allocation factor, the actual factor may differ, 
>    but it depends directly on the parameter set by the user. 
>    User can choose the parameter so that it suits the real allocation factor.

But this is not the answer on the question, is it? What is the point is
making it bigger if it can get smaller in the result? And the user can't
even understand how to select the factor he actually needs. For instance,
he sets 1.5, but he has no idea what will be the final value. How can one
tune it then? How to choose the value?

> diff --git a/small/small_class.h b/small/small_class.h
> new file mode 100644
> index 0000000..0677557
> --- /dev/null
> +++ b/small/small_class.h
> @@ -0,0 +1,218 @@
> +
> +/**
> + * CHAR_BIT
> + */
> +#include <limits.h>
> +
> +/**
> + *

Unnecessary empty line.

> + * small_alloc uses a collection of mempools of different sizes.
> + * If small_alloc stores all mempools in an array then it have to determine
> + * an offset in that array where the most suitable mempool is.
> + * Let's name the offset as 'size class' and the size that the corresponding
> + * mempool allocates as 'class size'.> diff --git a/test/small_class.c b/test/small_class.c
> new file mode 100644
> index 0000000..b56cfeb
> --- /dev/null
> +++ b/test/small_class.c
> @@ -0,0 +1,176 @@
> +#include "small/small_class.h"
> +#include "unit.h"
> +#include <math.h>
> +
> +#define SZR(arr) sizeof(arr) / sizeof(arr[0])

We have lengthof() in trivia/util.h.

The test below I still don't understand in a single bit :D
But I give up, and hope Alexander L. validated all the calculations
and ensured they don't make things slower.


More information about the Tarantool-patches mailing list