delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/04/24/01:47:09

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: Tim Prince <tprince AT computer DOT org>
Reply-To: tprince AT computer DOT org
To: Sami Korhonen <ssakorho AT messi DOT uku DOT fi>, cygwin AT cygwin DOT com
Subject: Re: 1.3.10 memcmp() bug
Date: Tue, 23 Apr 2002 22:43:27 -0700
References: <Pine DOT A41 DOT 4 DOT 20 DOT 0204240757560 DOT 120142-100000 AT messi DOT uku DOT fi>
In-Reply-To: <Pine.A41.4.20.0204240757560.120142-100000@messi.uku.fi>
MIME-Version: 1.0
Message-Id: <20020424054327.5443D2CA13@inet1.ywave.com>

On Tuesday 23 April 2002 22:04, Sami Korhonen wrote:
>  I wasnt sure wheter I should post about this on gcc bug report list or
> here. Anyways, it seems that using -O2 flag with gcc causes huge slowdown
> in memcmp(). However i dont see performance drop under linux, so I suppose
> it is cygwin issue.
>
> $ gcc memtest.c -O2 -o memtest ; ./memtest.exe
> Amount of memory to scan (mbytes)? 100
> Memory block size (default 1024)? 1024
> Allocating memory
> Testing memory - read (1 byte at time)
> Complete: 889.73MB/sec
> Testing memory - read (4 bytes at time)
> Complete: 3313.07MB/sec
> Freeing memory
>
> $ gcc memtest.c -o memtest ; ./memtest.exe
> Amount of memory to scan (mbytes)? 100
> Memory block size (default 1024)? 1024
> Allocating memory
> Testing memory - read (1 byte at time)
> Complete: 2517.94MB/sec
> Testing memory - read (4 bytes at time)
> Complete: 2933.50MB/sec
> Freeing memory
>
>
> '1 byte at time' is using memcmp() to compare two blocks.
You leave so many relevant considerations unspecified, that anything I say 
must be a stab in the dark.  I assume you have a standard cygwin 
installation, where binutils is built to honor only 4-byte alignments, while 
recent linux configurations provide for 16-byte alignments.  The significance 
of that is different on various CPU families, with code alignment being quite 
important on certain CPU's, and data alignment on others.  Do we assume that 
you are running on a 486, since you have not told gcc otherwise?  You may 
have fallen accidentally into good alignment in one case and bad in the 
other.  You might or might not be using similar versions of gcc in cygwin and 
linux.  If you would provide a test case, and mention some hardware 
parameters, some of the mystery could be eliminated; for example, we could 
find out whether memcmp() is code generated by gcc or from a library.  cygwin 
is not generally considered an important target for performance optimization, 
as you can see from the alignment considerations and the differences in the 
libraries.
-- 
Tim Prince

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019