From owner-freebsd-questions Tue May 15 7:40:38 2001 Delivered-To: freebsd-questions@freebsd.org Received: from MPI-Softtech.Com (mpi.mpi-softtech.com [208.60.120.177]) by hub.freebsd.org (Postfix) with ESMTP id 46BD037B423; Tue, 15 May 2001 07:40:28 -0700 (PDT) (envelope-from dleimbac@MPI-Softtech.Com) Received: from mpi.mpi-softtech.com (mpi.mpi-softtech.com [208.60.120.177]); by MPI-Softtech.Com (8.9.3/8.9.3/MPI-Softtech/evision: 1.3 $) with SMTP; id JAA01279; Tue, 15 May 2001 09:40:12 -0500 (CDT) Message-Id: <200105151440.JAA01279@MPI-Softtech.Com> Date: Tue, 15 May 2001 09:40:12 -0500 (CDT) From: Dave Leimbach Reply-To: Dave Leimbach Subject: Re: Gettimeofday Again... To: dleimbac@earthlink.net, wes@softweyr.com Cc: freebsd-questions@freebsd.org, arch@freebsd.org MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Content-MD5: IwjY9TXrjV34s8ShLBR/fg== X-Mailer: dtmail 1.3.0 CDE Version 1.3 SunOS 5.7 sun4u sparc Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG This is a valid point.... I will have to find the link that spawned this concern. It was an IBM exploration of gettimeofday on linux vs a comparable function in Windows. People immediately began claiming that linux is 2.5 x faster than Windows. I decided to try the "tests" myself and found that by the results that are generated FreeBSD came up more than 13 times slower than linux. I never admitted that the tests were a good benchmark for anything. I just thought that it was really damned slow :). I think SMP is a way more important topic so long as gettimeofday doesn't get called in thread context switches :).. This was mentioned before and the overhead of gettimeofday could come into play in different areas so I felt it was important to have a fast & accurate one. I have no idea how to implement one so I should probably shut up now :). Dave >Date: Tue, 15 May 2001 08:20:48 -0600 >From: Wes Peters >X-Accept-Language: en >MIME-Version: 1.0 >To: dleimbac@earthlink.net >CC: freebsd-questions@freebsd.org, arch@freebsd.org >Subject: Re: Gettimeofday Again... >Content-Transfer-Encoding: 7bit > >dave wrote: >> >> Well I have been on the IRC in and out of mail list archives and cannot get >> a good answer to this question... >> >> Why does gettimeofday perform so poorly on FreeBSD vs the same hardware on >> Linux 2.4.2? >> >> ---SNIP----- >> #include >> #include >> >> int main() { >> struct timeval tv1, tv2, tv3; >> >> gettimeofday(&tv1, 0); >> gettimeofday(&tv2, 0); >> gettimeofday(&tv3, 0); >> >> printf("Time 1 %d:%d\n", tv1.tv_sec, tv1.tv_usec); >> printf("Time 2 %d:%d\n", tv3.tv_sec, tv3.tv_usec); >> >> } >> ----SNIP----- >> >> I get anywhere from 14usec to 17usec just for the call to gettimeofday. >> >> On the 2.4.2 linux kernel its something like 3usec. >> >> I just want to know why we are so much slower. >> >> I have heard the "caching" argument and it doesn't float very well since >> all I can find is CPU based L1 cache which should also apply to FreeBSD. >> That's principle of locality stuff and more on the hardware side. Since I >> am running on identical hardware I don't see how >> this is possible except for a potential problem/lack of optimization in >> FreeBSD. >> >> Don't get me wrong... I love FreeBSD... and it generally outperforms linux >> everywhere I use it. I just don't understand this huge gap in performance. > >Show us a profile of an application where this is a problem. Premature >optimization is the root of much evil. Would you rather have somebody >spend time on optimizing gettimeofday, or working on SMP or kqueue or >doing a security audit, something with meaning? > >-- > "Where am I, and what am I doing in this handbasket?" > >Wes Peters Softweyr LLC >wes@softweyr.com http://softweyr.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message