Closed Bug 164278 Opened 23 years ago Closed 23 years ago

reading cookie file seems very inefficient

Categories

(Core :: Networking: Cookies, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.2beta

People

(Reporter: Brade, Assigned: Brade)

Details

(Keywords: perf, Whiteboard: chimera)

Attachments

(2 files)

While starting up Chimera, the cookie code made 183 read calls to the system (out of 828 total read calls). The cookies file appears to be read in 128 byte blocks rather than a more optimal size like 4k or 8k. Increasing the buffer size would reduce the number of system calls made and increase performance. Also, I'm somewhat surprised that the buffer is not passed around but instead is a static. Wouldn't it be clearer to pass around the buffer?
Keywords: nsbeta1, perf
Is there a reason that the component is set to Chimera rather than browser? Also should the OS be All instead of MacOSX?
Priority: -- → P2
changing product/component and platform/OS (I was busy filing lots of performance and memory leak issues and just kept reusing the same page without resetting everything.)
Component: General → Cookies
OS: MacOS X → All
Product: Chimera → Browser
Hardware: Macintosh → All
Whiteboard: chimera
Version: unspecified → other
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.2beta
All that is required is to change the definition of bufsize at http://lxr.mozilla.org/seamonkey/source/extensions/cookie/nsUtils.cpp#50 ?
Actually, I would think that there is a better class out there to use to read the file into a buffer. At a minimum, increasing the buffer size would be ok. However, I really don't see any reason for the cookie code to keep around a static buffer (no matter what size it is).
here is a proof of concept or a first attempt (whichever way you want to think about it). This is more inline with what I was thinking. I was actually hoping to use the bufferedInputStream class but that is in necko and I'm not sure that can be used in this module.
Kathy, Thanks. I was about to start on this bug today, so your "proof of concept" is very timely. I look it over right now and either use it as is or modify it if necessary.
Kathy's proof of concept is much more than that -- it is a final patch. I'm for checking it in as is. r = morse
Attachment #96898 - Flags: review+
previous patch is for Chimera branch; this patch is for trunk
cc heikki for sr= on both patches -->brade
Assignee: morse → brade
Status: ASSIGNED → NEW
Comment on attachment 97071 [details] [diff] [review] this is the patch to apply to the trunk (essentially same except string changes made to api on trunk) r=morse for trunk patch
Comment on attachment 96898 [details] [diff] [review] proof of concept / first attempt >Index: nsUtils.cpp >+// static PRInt32 next = bufsize, count = bufsize; nit: remove this comment. sr=darin
Attachment #96898 - Flags: superreview+
Comment on attachment 97071 [details] [diff] [review] this is the patch to apply to the trunk (essentially same except string changes made to api on trunk) sr=darin
Attachment #97071 - Flags: superreview+
Attachment #97071 - Flags: review+
Patch checked in on trunk. Kathy, could you please do the checkin for the Chimera branch. Don't forget to remove the comment that darin noted. Thanks.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: