Hi,
I committed the patch. Note according to my test result this implementation
is about three times faster than the previous one so I consider it to be
obvious improvement. Of course this only affects ByteEncoding.GetString()
but other encodings were not using StringBuilder so they are faster altough
they could be improved using unsafe code but that requires some
infrastructural changes in I18N.
For the referenced bug:
When calling for example MethodInfo.Invoke or Delegate.CreateDelegate
without ReflectionPermissionFlag.MemberAccess permission
MethodAccessException has to be thrown. But I don't think that this is a
mysterious bug. This behaviour is documented on MSDN and if you search for
MethodAccessException you will find the methods that throw
MethodAccessException with the description when they trow it.
Anyway the bug in Mono is that it doesn't enforce this check not that it
grants ReflectionPermissionFlag.MemberAccess permission to code. If we
grant ReflectionPermissionFlag.MemberAccess permission (or full trust) to
class library assemblies we can use reflection safely.
Kornél
----- Original Message -----
From: "Atsushi Eno" <[EMAIL PROTECTED]>
To: "Kornél Pál" <[EMAIL PROTECTED]>
Cc: <mono-devel-list@lists.ximian.com>
Sent: Tuesday, June 13, 2006 4:10 PM
Subject: Re: [Mono-dev] [PATCH] Speed up ByteEncoding.GetString()
I see no problem on this patch, so feel free to go ahead, though the
improvement is not obvious now. But it would be faster in general
cases.
Just an extra note, see bug #70841 to see concrete nonpublic method
access problem that Miguel was worried.
Atsushi Eno
Kornél Pál wrote:
Is this patch OK to commit?
Kornél
----- Original Message ----- From: "Kornél Pál" <[EMAIL PROTECTED]>
To: "Miguel de Icaza" <[EMAIL PROTECTED]>
Cc: <mono-devel-list@lists.ximian.com>
Sent: Friday, June 09, 2006 2:24 PM
Subject: Re: [Mono-dev] [PATCH] Speed up ByteEncoding.GetString()
OK, now I understan your problem.
Please review this modified patch.
Kornél
----- Original Message ----- From: "Miguel de Icaza" <[EMAIL PROTECTED]>
To: "Kornél Pál" <[EMAIL PROTECTED]>
Cc: <mono-devel-list@lists.ximian.com>
Sent: Friday, June 09, 2006 2:01 PM
Subject: Re: [Mono-dev] [PATCH] Speed up ByteEncoding.GetString()
Hello,
Invoking non-public methods using SRE is widely used by our class
library,
it is supported by the ECMA standards so I don't really understand
what
you
mean on "access to internal methods will at some point broken".
As I said, this might be something that we will fix in the future, and
although it works today, it does not mean it will work today, I do not
want to add more dependencies that might prevent us from fixing it in
the future.
Besides, poking at string internals is not something am very excited
about supporting nor encouraging. The last time we did something
"unsafe" like this, it was reviewed over and over, and it turned out to
be buggy, it took months to track the mysterious bug because the
conditions were very hard to reproduce.
Note that even using "new string ((char) 0, length)" is faster than
the
current implementation.
That part of the patch is fine with me.
Miguel
------------------------------------------------------------------------
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list