From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 4C92B4765E2 for ; Thu, 24 Dec 2020 18:13:36 +0300 (MSK) References: <8f959e036941677f2e8a18a7aadb2b7e32e408d0.1608715671.git.mechanik20051988@gmail.com> From: Vladislav Shpilevoy Message-ID: <782917c3-f21b-c0b3-05fe-1c6865051e27@tarantool.org> Date: Thu, 24 Dec 2020 16:13:34 +0100 MIME-Version: 1.0 In-Reply-To: <8f959e036941677f2e8a18a7aadb2b7e32e408d0.1608715671.git.mechanik20051988@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH v2 1/3] small: implement new size class evaluation List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mechanik20051988 Cc: tarantool-patches@dev.tarantool.org 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 > + > +/** > + * 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 > + > +#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.