Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Mar 2002 10:45:18 +0200
From:      Dimitar Peikov <mitko@rila.bg>
To:        freebsd-hackers@freebsd.org
Subject:   Swapping performance
Message-ID:  <20020307104518.0f73740b.mitko@rila.bg>

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

[-- Attachment #1 --]
I start some performance tests on -stable and on SuSE 7.1 / 2.4.17. I
don't comment about 'bzero' performance, but when RAM is over, Linux
is much faster. I have no idea what is the algorithm of swapping but it seems that the granularity of swapping pieces is the key or the importance of swapping memory blocks of certain task. Ooo I forgot to say that the both machines have the same hardware, IBM 300PL, 256 RAM and no other tasks running. I had to run these tests to choose the fastest platform for building our software indexes, which requires a lot of math and memory operations.

--- with bzero ---
Linux$ time ./malloc_test
*#
real    0m37.640s
user    0m1.370s
sys     0m2.950s
Linux$

FreeBSD$ time ./malloc_test
*#
real    0m46.640s
user    0m2.280s
sys     0m2.550s
FreeBSD$

--- without bzero ---
Linux$ time ./malloc_test
*#
real    0m6.371s
user    0m0.450s
sys     0m1.510s
Linux$

FreeBSD$ time ./malloc_test
*#
real    0m11.571s
user    0m1.150s
sys     0m1.830s
FreeBSD$



-- 
Dimitar Peikov
Programmer Analyst
Globalization Group
"We Build e-Business"  

RILA Solutions  
27 Building, Acad.G.Bonchev Str.  
1113 Sofia, Bulgaria  

phone: (+359 2) 9797320 
phone: (+359 2) 9797300 
fax:   (+359 2) 9733355  
http://www.rila.com 

[-- Attachment #2 --]
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#define MALLOC_SIZE 1024*1024*256

int main(int argc, char **argv) {
  char *ptr;
  int i, i_count;
  int j;

  ptr = (char *) malloc(MALLOC_SIZE);
  bzero(ptr, MALLOC_SIZE);

  i_count = MALLOC_SIZE / 16;
  fprintf(stderr, "*");
  for (i = 0; i < i_count; i ++) {
      ptr[i >> 4] = ptr[(i >> 3) + 1]++;
  }
  fprintf(stderr, "#");
  for (j = 0; j < i_count; j ++) {
      ptr[j << 4] = ptr[(j >> 3) + 1]++;
  }

  free(ptr);
  return 0;
}

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