Yikes!  I'll take a look at this next Tuesday (the entire team is on vacation 
Until then) - a quick look over the code doesn't show us doing anything too 
stupid 
so I'm not sure what the problem is :(  But feel free to open a bug in the mean
time.

> -----Original Message-----
> From: users-boun...@lists.ironpython.com [mailto:users-
> boun...@lists.ironpython.com] On Behalf Of Michael Foord
> Sent: Thursday, May 27, 2010 9:41 AM
> To: Discussion of IronPython
> Subject: [IronPython] Performance str.replace in Silverlight
> 
> Hey guys,
> 
> I just tracked down a really nasty performance bug in our Silverlight
> application. It turned out that doing a simple string replace in a 400
> character string was taking 700ms. As we actually do two replaces and
> the text is usually substantially longer this was a real problem.
> 
> I fixed the problem by switching to explicitly calling the .NET
> String.Replace instead of str.replace, so it looks like an IronPython
> issue. It doesn't happen with *all* text, but it looks like non-ascii
> exacerbates the problem.
> 
> The particular text that triggered it was:
> 
> Die Neuanlage einer Welle muss auch zu Einträgen in der Tabelle
> dbo_tv_wellenwebsitesfirmenverbinder führen. Dabei werden die
> Zuordnungen aus der Vorwelle bei der Neuanlage einer neuen Welle
> einmalig übernommen. Jede Zeile der Vorwelle wird also kopiert und die
> Kopie erhält die Welle_uniqueID der neuen Welle. Die Verbindung
> zwischen
> Website_uniqueID <-> Firmen_uniqueID <-> FirmenAbrechnung_uniqueID
> bleibt somit erhalten.
> 
> The replace code was:
> 
> text = text.replace('\r\n', '\n').replace('\r', '\n')
> 
> The fix was:
> 
> text = String.Replace(text, '\r\n', '\n')
> text = String.Replace(text, '\r', '\n')
> 
> All the best,
> 
> Michael Foord
> 
> --
> http://www.ironpythoninaction.com/
> http://www.voidspace.org.uk/blog
> 
> READ CAREFULLY. By accepting and reading this email you agree, on
> behalf of your employer, to release me from all obligations and waivers
> arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-
> service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-
> disclosure, non-compete and acceptable use policies ("BOGUS
> AGREEMENTS") that I have entered into with your employer, its partners,
> licensors, agents and assigns, in perpetuity, without prejudice to my
> ongoing rights and privileges. You further represent that you have the
> authority to release me from any BOGUS AGREEMENTS on behalf of your
> employer.
> 
> 
> _______________________________________________
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to