[xml] xmlDocDumpMemory() is VERY slow on Win32


Earlier today I logged a bug on bugzilla regarding a problem that seems 
to affect Win32 only.  Daniel Veillard replied to say that he can't 
really help since he doesn't have access to Windows machines, and 
suggested that I try this list instead.

Please see http://bugzilla.gnome.org/show_bug.cgi?id=146697 for 
background information, but basically I have reduced the problem to 
this:  With a particular 10MB XML file, the following program takes 
about 15 seconds to complete the while() loop on Win32, but only about 1 
second on a Linux machine:

#include <stdio.h>
#include <time.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
void main(void) {
  char *file = "test.xml";
  time_t start, end;
  xmlDocPtr doc;
  xmlChar *result = NULL;
  int len = 0;
  while (1) {
    if ((doc = xmlReadFile(file, NULL, 0)) != NULL) {
      printf("parsed OK\n");
    else {
      printf("parsed NOT OK\n");
    xmlDocDumpMemory(doc, &result, &len);
    if (result != NULL) {
      printf("dumped OK\n");
    else {
      printf("dumped NOT OK\n");
    printf("Took %d seconds\n", end - start);

Removing the xmlDocDumpMemory() call (and error checking) reduces the 
time to about 1 second on my Win32 machine (and made little appreciable 
difference on Linux).

Thus, it appears that xmlDocDumpMemory() runs very slowly on Win32.

I have the "test.xml" file that the program uses on an FTP site; please 
email me for login credentials if you want to get it.

I'm using libxml2-2.6.11 on WinXP Service Pack 1.  This was built with 
MS VC++ 6.0 Service Pack 5 by cd'ing to libxml2's win32/ directory and 
running the command:

    cscript configure.js prefix=C:\libxml2 zlib=1

and then just running "nmake" and "nmake install".  (This builds using 
the msvcrt.lib CRT.)

This links against GNU libiconv (1.9.1) and zlib (1.2.1), also built 
with msvcrt.lib.  The above program is then built with:

    cl -MD test.c libxml2_a.lib iconv.lib zlib.lib ws2_32.lib

(where the -MD again specifies the msvcrt.lib CRT).

One warning was produced by the linker:

    LINK : warning LNK4049: locally defined symbol "_xmlFree" imported

I don't know if that is relevant or not?

Any help would be greatly appreciated.  This is quite an issue for me.

- Steve

Radan Computational Ltd.

The information contained in this message and any files transmitted with it are confidential and intended for 
the addressee(s) only.  If you have received this message in error or there are any problems, please notify 
the sender immediately.  The unauthorized use, disclosure, copying or alteration of this message is strictly 
forbidden.  Note that any views or opinions presented in this email are solely those of the author and do not 
necessarily represent those of Radan Computational Ltd.  The recipient(s) of this message should check it and 
any attached files for viruses: Radan Computational will accept no liability for any damage caused by any 
virus transmitted by this email.

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