Re: [xml] xmlDocDumpMemory() is VERY slow on Win32


Steve's simple little sample program gives some very interesting results on my Windows 2000 system. Using VC 
7, I get an executable that takes about 19 seconds to run. When I compile with gcc, the resulting executable 
runs in under a second. If I use the Borland compiler to build a command-line application, it also requires 
about 19 seconds to run, but if I use the same compiler, but build it as a VCL (Windows) application, it runs 
in under 1 second! No such change in performance was obtained, however, when using VC 6 to build a Windows 

These differences are apparently due to differences in the way the various run-time libraries are handling 

Well, Steve, maybe you can just switch compilers and RTLs instead of switching platforms <G>.

Eric Zurcher
CSIRO Livestock Industries
Canberra, Australia
Eric Zurcher csiro au

-----Original Message-----
I now share Igor's bad feeling about this in the light of the following 

#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <time.h>
void main(void) {
  char *buf;
  int i, size;
  time_t start, end;
  size = 16000;
  if ((buf = malloc(size)) == NULL) {
    printf("malloc failed\n");
  else {
    printf("malloc OK (%d)\n", size);
  for (i = 0; i < 640; i++, size += 16000) {
    if ((buf = (char *)realloc(buf, size + 16000)) == NULL) {
      printf("%03d: realloc failed\n", i);
    else {
      printf("%03d: realloc OK (%d to %d)\n", i, size, size + 16000);
  printf("%d seconds\n", end - start);

Could somebody please try this on Linux (well, anything other than Win32 
I guess) and tell me how long it takes to run?

On my P4 2GHz Win32 box it takes 15seconds -- exactly the same time as 
the XML parsing/dumping earlier!  (And it's just as slow without the 
printf() calls in it.)

I dare say the time will be 0 or 1 second on Linux.

My soul is indeed lost :(  Where do I go from here?  (Don't say Linux...)

- Steve

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]