Closed Bug 562519 Opened 16 years ago Closed 16 years ago

cache result from PR_GetPhysicalMemorySize

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

Details

(Keywords: perf)

Attachments

(1 file, 1 obsolete file)

Most systems I've dealt with don't employ 'hot-memory add', as a result each additional call to PR_GetPhysicalMemorySize is incredibly expensive for what is generally a useless operation. Technically w2k3 svr, Solaris 7+ and in theory Linux support how-memory add. An engineer at Nokia reported that during profiling of browsing with gecko1.9.2: > According to strace there are up to 15 opens for /proc/meminfo file per second. ... 1517 10:32:27.240142 open("/proc/meminfo", O_RDONLY) = 45 ... 1517 10:32:31.314422 open("/proc/meminfo", O_RDONLY) = 45 For Gecko on the n900, the amount of physical memory will never change and certainly not at runtime. per bug 560090 comment 3, NSPR is uninterested in offering a caching version of this function. while I could call xpcom to get this information, I think the overhead of calling xpcom isn't worth the space savings for the statics i'm adding here.
Attached patch proposal (obsolete) — — Splinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #442262 - Flags: review?(cbiesinger)
Comment on attachment 442262 [details] [diff] [review] proposal - PRUint64 size = PR_GetPhysicalMemorySize(); + static PRUint64 size; + if (!size) { + size = PR_GetPhysicalMemorySize(); Why didn't you just add "static" to the variable, i.e.: static PRUint64 size = PR_GetPhysicalMemorySize();
Attachment #442262 - Flags: review?(cbiesinger) → review-
Attached patch static calls — — Splinter Review
Attachment #442262 - Attachment is obsolete: true
Attachment #443613 - Flags: review?(cbiesinger)
Attachment #443613 - Flags: review?(cbiesinger) → review+
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: [build_warning]
Whiteboard: [build_warning]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: