value_copy in sfiglue.c (Re: Optimizations)



[splitting up your mail as commenting about the various patches
is better handled by spawning individual threads]

On Tue, 3 Feb 2004, Stefan Westerfeld wrote:

> * No patches: performance of the unmodified build.
>
> stefan@luna1:~/src/beast-performance-eval/beast/tests$ perftest
> 0.980416 seconds for 10000 invocations => 10199.751787 invocations/second, 0.000098 sec per invocation
>
> * Patch #1: removes redundant value copy, by appending an empty value and
> filling it directly.
>
> Index: sfiglue.c
> ===================================================================
> RCS file: /cvs/gnome/beast/sfi/sfiglue.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 sfiglue.c
> --- sfiglue.c	23 Dec 2003 04:50:55 -0000	1.9
> +++ sfiglue.c	2 Feb 2004 20:57:02 -0000
> @@ -339,14 +339,8 @@ sfi_glue_call_valist (const gchar *proc_
>  	error = g_strdup_printf ("%s: invalid category_type (%u)", G_STRLOC, arg_type);
>        else
>  	{
> -	  GValue value = { 0, };
> -	  g_value_init (&value, collect_type);
> -	  G_VALUE_COLLECT (&value, var_args, 0, &error);
> -	  if (!error)
> -	    {
> -	      sfi_seq_append (seq, &value);
> -	      g_value_unset (&value);
> -	    }
> +	  GValue *value = sfi_seq_append_empty (seq, collect_type);
> +	  G_VALUE_COLLECT (value, var_args, 0, &error);
>  	}
>        if (error)
>  	{

this change alters behaviour, in case of error, the original
version doesn't append to the sequence while your version
does (unconditionally).

> stefan@luna1:~/src/beast-performance-eval/beast/tests$ perftest
> 0.965613 seconds for 10000 invocations => 10356.114726 invocations/second, 0.000097 sec per invocation

>
>    Cu... Stefan

---
ciaoTJ






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]