[Mono-dev] [PATCH] mono_exception_from_name_two_strings performance

Zoltan Varga vargaz at gmail.com
Fri Jan 4 17:00:21 EST 2008


This is ok to check in.

    Zoltan

On Jan 4, 2008 10:07 PM, Andreas Färber <andreas.faerber at web.de> wrote:
> Hello,
>
> I've noticed the following code in
> mono_exception_from_name_two_strings (metadata/exception.c):
>
>         iter = NULL;
>         while ((m = mono_class_get_methods (klass, &iter))) {
>                 MonoMethodSignature *sig;
>
>                 if (strcmp (".ctor", mono_method_get_name (m)))
>                         continue;
>                 sig = mono_method_signature (m);
>                 if (sig->param_count != count)
>                         continue;
>
>                 if (sig->params [0]->type != MONO_TYPE_STRING)
>                         continue;
>                 if (count == 2 && sig->params [1]->type != MONO_TYPE_STRING)
>                         continue;
>                 method = m;
>         }
>
> This is used at startup from mono_runtime_init (appdomain.c) to
> initialize three Exceptions.
>
> Shouldn't we break out of this loop once we've assigned "method"? In
> gdb I got two no-op iterations after having assigned the variable, for
> the OutOfMemoryException - eliminating such iterations would slightly
> increase startup time and facilitate single-step debugging.
> A class shouldn't have more than one method of name ".ctor" with
> identical param count and types.
>
> Bootstrapping appears to work with the patch applied. Please review.
>
> Andreas
>
>
>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>



More information about the Mono-devel-list mailing list