[Mono-dev] [PATCH] mono_exception_from_name_two_strings performance
Andreas Färber
andreas.faerber at web.de
Fri Jan 4 16:07:56 EST 2008
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: exception-break.diff
Type: application/octet-stream
Size: 339 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080104/65a9839b/attachment.obj
-------------- next part --------------
More information about the Mono-devel-list
mailing list