[Tarantool-patches] [PATCH v3 1/2] box: speed up tuple_field_map_create

Nikita Pettik korablev at tarantool.org
Fri Dec 11 17:32:53 MSK 2020


On 11 Dec 09:34, Serge Petrenko wrote:
> 
> 10.12.2020 20:17, Nikita Pettik пишет:
> 
> > I'd rewrite this part as:
> > 
> > diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c
> > index 6c9b2a255..d6655256a 100644
> > --- a/src/box/tuple_format.c
> > +++ b/src/box/tuple_format.c
> > @@ -912,10 +912,12 @@ tuple_field_map_create_plain(struct tuple_format *format, const char *tuple,
> >          }
> >   end:
> > -       return validate ?
> > -              tuple_format_required_fields_validate(format, required_fields,
> > -                                                    required_fields_sz) :
> > -              0;
> > +       if (validate) {
> > +               return tuple_format_required_fields_validate(format,
> > +                                                            required_fields,
> > +                                                            required_fields_sz);
> > +       }
> > +       return 0;
> >   }
> > 
> > Up to you. Anyway LGTM
> 
> Hm, what about this? Applied. 
> 
> diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c
> index 6c9b2a255..5f5e833b4 100644
> --- a/src/box/tuple_format.c
> +++ b/src/box/tuple_format.c
> @@ -912,10 +912,11 @@ tuple_field_map_create_plain(struct tuple_format
> *format, const char *tuple,
>         }
> 
>  end:
> -       return validate ?
> -              tuple_format_required_fields_validate(format,
> required_fields,
> - required_fields_sz) :
> -              0;
> +       if (!validate)
> +               return 0;
> +
> +       return tuple_format_required_fields_validate(format,
> required_fields,
> + required_fields_sz);

Fine, thx.

>  }
> 
>  /** @sa declaration for details. */
> 
> > 
> > > +end:
> > > +	return validate ?
> > > +	       tuple_format_required_fields_validate(format, required_fields,
> > > +						     required_fields_sz) :
> > > +	       0;
> > > +}
> > > +
> 
> -- 
> Serge Petrenko
> 


More information about the Tarantool-patches mailing list