qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kim van der Riet <kim.vdr...@redhat.com>
Subject Re: Small performance issue
Date Fri, 15 Dec 2006 18:17:34 GMT
I'll get to this later this afternoon. Thanks for the patch.

There is a function to do this already in CppGenerator: setRef(), which
changes both string and FieldTable to const &. A shorter (but
equivalent) change would be:

-			sb.append(indent + (defineFlag ? fieldDomainPair[FIELD_DOMAIN] + " " : "") +
+                       sb.append(indent + (defineFlag ? setRef(fieldDomainPair[FIELD_DOMAIN])
+ " " : "") +

Kim

On Fri, 2006-12-15 at 18:47 +0100, Jim Meyering wrote:
> Index: src/org/apache/qpid/gentools/CppGenerator.java
> ===================================================================
> --- src/org/apache/qpid/gentools/CppGenerator.java	(revision 487512)
> +++ src/org/apache/qpid/gentools/CppGenerator.java	(working copy)
> @@ -1490,7 +1490,12 @@
>  		{
>  			int ordinal = oItr.next();
>  			String[] fieldDomainPair = ordinalFieldMap.get(ordinal);
> -			sb.append(indent + (defineFlag ? fieldDomainPair[FIELD_DOMAIN] + " " : "") +
> +			String type_str = fieldDomainPair[FIELD_DOMAIN];
> +			if (type_str.compareTo("string") == 0)
> +			{
> +			  type_str = "const " + type_str + "&";
> +			}
> +			sb.append(indent + (defineFlag ? type_str + " " : "") +
>  				fieldDomainPair[FIELD_NAME] + (initializerFlag ? "(" + fieldDomainPair[FIELD_NAME]
+ ")" : "") +
>  				(oItr.hasNext() ? "," : "") + cr);
>  		}



Mime
View raw message