Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jul 2002 18:44:02 -0700 (PDT)
From:      Si-Liang Chang <slchang@csie.nctu.edu.tw>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/40714: Functions with more than 1 arguments Gets More Executing Time.
Message-ID:  <200207180144.g6I1i25M096588@www.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         40714
>Category:       kern
>Synopsis:       Functions with more than 1 arguments Gets More Executing Time.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          wish
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 17 18:50:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Si-Liang Chang
>Release:        4.6-Release
>Organization:
Institute of Physics, National Chiao-Tung Univ., Taiwan, R.O.C
>Environment:
FreeBSD orchid 4.6-RELEASE FreeBSD 4.6-RELEASE #0: Tue Jun 11 06:14:12 GMT 2002     murray@builder.freebsdmall.com:/usr/src/sys/compile/GENERIC  i386      
>Description:
When running my molecule dynamics simulation programs on FreeBSD, they are always about 33% slower than those (with the same conditions) run on a Linux box or Solaris. In order to simplify the problem, we run several testing programs. Finally, we conclude that, functions with more than 1 arguments spend much executing time.
>How-To-Repeat:
In Program 1, it spends about 7.534u on our PPro FreeBSD 4.6R mechine.
In Program 2, it spends about 2.904u on our PPro FreeBSD 4.6R mechine.

In the meanwhile,
In Program 1, it spends about 2.56u on our PPro Solaris 8 mechine.
In Program 2, it spends about 2.66u on our PPro Solaris 8 mechine.

Of course, the problem exist for mechines with higher speed such as AMD XP 1G and XP+ 1.8G.

Program 1------------------------------

#include <stdio.h>

double Fun(double,double,double);

int main(void) {
    double x,y,z,s;
    
    s=0.0;
    for(x=0.0;x<1.0;x=x+0.001) {
        for(y=0.0;y<1.0;y=y+0.001) {
            for(z=0.0;z<1.0;z=z+0.1) {
                s=Fun(x,y,z);
            }
        }
    }
}
double Fun(double x,double y,double z) {
    return(x+y+z);
}


Program 2 ---------------------------------

#include <stdio.h>

double Fun(double);

int main(void) {
    double x,y,z,s;
    
    s=0.0;
    for(x=0.0;x<1.0;x=x+0.001) {
        for(y=0.0;y<1.0;y=y+0.001) {
            for(z=0.0;z<1.0;z=z+0.1) {
                s=Fun(x)+Fun(y)+Fun(z);
            }
        }
    }
}
double Fun(double x) {
    return(x+1.0);
}

>Fix:
      
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207180144.g6I1i25M096588>