Open Bug 195910 Opened 21 years ago Updated 1 year ago

PR_Open/PR_Close efficiency need improvement

Categories

(NSPR :: NSPR, defect)

4.1.2
x86
Linux
defect

Tracking

(Not tracked)

People

(Reporter: kirk.erickson, Unassigned)

Details

Sun BugTraq Bug Id:  4826694.
Filed by pallab.bhattacharya@sun.com.
	
Hardware version: ultra
O/S version (unbundled products): generic

 Comments:
Tested with NSPR 4.1.2 -- Cannot Put that version in Customer-Call-Info

Microbenchmarks show the perf of NSPR-Open/Close is about 16 to 30% higher
than libc/pthread version of the same function -- 

Open Time (micro-sec), Open call followed by a Close before next Open call
NSPR    PTHREAD/LIBC
------- ------------
   9760    5200
   6080    4720
   5760    4400
   5520    4480
   5440    4560
------- -------
   6512    4672
------- -------

Open Time (micro-sec) Open call followed by another Open call (close never called)
NSPR    PTHREAD
------- -------
  11920    6800
   9360    6000
   8000    5680
   9760    6080
   8080    5600
------- -------
   9424    6032
------- -------


Close Time(micro-sec)
NSPR    PTHREAD/LIBC
------- ------------
   4400    3120
   3280    2720
   3200    2720
   3120    2720
   3200    2720
------- -------
   3440    2800
------- -------
pallab.bhattacharya@sun.com 2003-03-11
Addl. Info  to root-cause the perf. issue
		
Series of if/case before/after the sys-call and a generic pt_SetMethods
  			
_PR_Getfd()/_PR_Putfd() causes serialization
  			
The conversion from PR_<OPEN>_FLAGS to OS_<OPEN>_FLAGS -- with a series of if
blocks -- it could be avoided if the numerical values of PR_<OPEN>_FLAGS are
same  as the OS_<OPEN>_FLAGS
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  	  
     if (flags & PR_RDONLY) osflags |= O_RDONLY;
     if (flags & PR_WRONLY) osflags |= O_WRONLY;
     if (flags & PR_RDWR) osflags |= O_RDWR;
     if (flags & PR_APPEND) osflags |= O_APPEND;
     if (flags & PR_TRUNCATE) osflags |= O_TRUNC;
     if (flags & PR_EXCL) osflags |= O_EXCL;
     if (flags & PR_SYNC)
    {
#if defined(O_SYNC)
         osflags |= O_SYNC;
#elif defined(O_FSYNC)
         osflags |= O_FSYNC;
#else
#error "Neither O_SYNC nor O_FSYNC is defined on this platform"
#endif
    } 
    if (flags & PR_CREATE_FILE)
    {
        osflags |= O_CREAT;
        if (NULL !=_pr_rename_lock)
            PR_Lock(_pr_rename_lock);
    }
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Pallab:

Thank you for your analysis of the performance problems.

We can't change the numerical values of the PR_<OPEN> flags
because that will break binary compatibility.  Is there
another solution that does not require changing the numerical
values of the PR_<OPEN> flags?
QA Contact: wtchang → nspr
Severity: normal → S3

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: wtc → nobody
You need to log in before you can comment on or make changes to this bug.