[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1485499 - /subversion/trunk/subversion/libsvn_ra_svn/marshal.c

From: Blair Zajac <blair_at_orcaware.com>
Date: Wed, 22 May 2013 17:01:34 -0700

On 05/22/2013 04:22 PM, stefan2_at_apache.org wrote:
> Author: stefan2
> Date: Wed May 22 23:22:22 2013
> New Revision: 1485499
>
> URL: http://svn.apache.org/r1485499
> Log:
> Reduce ra_svn protocol parsing overhead.
>
> * subversion/libsvn_ra_svn/marshal.c
> (vparse_tuple): test for the most frequent item types first
>
> Modified:
> subversion/trunk/subversion/libsvn_ra_svn/marshal.c
>
> Modified: subversion/trunk/subversion/libsvn_ra_svn/marshal.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/marshal.c?rev=1485499&r1=1485498&r2=1485499&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_ra_svn/marshal.c (original)
> +++ subversion/trunk/subversion/libsvn_ra_svn/marshal.c Wed May 22 23:22:22 2013
> @@ -1202,14 +1202,15 @@ static svn_error_t *vparse_tuple(const a
> if (**fmt == '?')
> (*fmt)++;
> elt = &APR_ARRAY_IDX(items, count, svn_ra_svn_item_t);
> - if (**fmt == 'n' && elt->kind == SVN_RA_SVN_NUMBER)
> - *va_arg(*ap, apr_uint64_t *) = elt->u.number;
> - else if (**fmt == 'r' && elt->kind == SVN_RA_SVN_NUMBER)
> - *va_arg(*ap, svn_revnum_t *) = (svn_revnum_t) elt->u.number;
> - else if (**fmt == 's' && elt->kind == SVN_RA_SVN_STRING)
> - *va_arg(*ap, svn_string_t **) = elt->u.string;
> + if (**fmt == '(' && elt->kind == SVN_RA_SVN_LIST)
> + {
> + (*fmt)++;
> + SVN_ERR(vparse_tuple(elt->u.list, pool, fmt, ap));
> + }

Out of curiosity, how much cost is there in the double dereferencing of
fmt? Could you save it in a local variable and do the if/else on that
instead? Also, would a switch block be more efficient?

Blair
Received on 2013-05-23 02:02:07 CEST

This is an archived mail posted to the Subversion Dev mailing list.