[Mono-bugs] [Bug 71413][Nor] New - Path.GetFullPath is heavy on string allocations
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 18 Jan 2005 14:22:08 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by joeshaw@novell.com.
http://bugzilla.ximian.com/show_bug.cgi?id=71413
--- shadow/71413 2005-01-18 14:22:08.000000000 -0500
+++ shadow/71413.tmp.27756 2005-01-18 14:22:08.000000000 -0500
@@ -0,0 +1,32 @@
+Bug#: 71413
+Product: Mono: Class Libraries
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: joeshaw@novell.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Summary: Path.GetFullPath is heavy on string allocations
+
+I was using Ben's profiler on beagle and I noticed that we were allocating
+something like 1.1 megs on the heap just from Path.GetFullPath. The call
+was pretty unnecessary, so simply removing it cut our usage in half, but
+the function itself seems to be quite heavy on the allocations.
+
+The profiler reported 1.1 MB usage from 10471 calls. That breaks down to
+about 110 bytes per allocation. None of the paths involved were longer
+than 80 bytes, and my guess is that the median would be around 20. Instead
+of splitting up the path and putting it back together, the code could be
+smarter when looking for multiple path separators and . and ..
+
+Of the 1.1 megs I was able to shave off half of it thanks to
+conditionalizing the call with Path.IsPathRooted, but the other half is
+still there because it's called in the constructor for DirectoryInfo. Can
+we eliminate that call? Or at least optimize Path.GetFullPath.