Performance ECC-480: Reduce function call overhead

This commit is contained in:
Shahram Najm 2017-06-14 18:26:51 +01:00
parent 47695e9168
commit 2d44fda68d
1 changed files with 9 additions and 2 deletions

View File

@ -736,8 +736,12 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
long pos = a->offset*8;
grib_handle* hand = NULL;
#ifdef DEBUG
err=grib_value_count(a,&rlen);
if (err) return err;
Assert(!err);
Assert(rlen == 1);
#endif
rlen = 1; /* ECC-480 Performance: avoid func call overhead of grib_value_count */
if(!self->table) self->table = load_table(self);
@ -754,7 +758,10 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
return GRIB_SUCCESS;
}
hand = grib_handle_of_accessor(a);
/* ECC-480 Performance: inline the grib_handle_of_accessor here to reduce func call overhead */
if (a->parent==NULL) hand = a->h;
else hand = a->parent->h;
for(i=0; i< rlen;i++){
val[i] = (long)grib_decode_unsigned_long(hand->buffer->data , &pos, self->nbytes*8);
}