[Top][All Lists]

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

[Gnumed-devel] profiling importing to gnumed

From: Syan Tan
Subject: [Gnumed-devel] profiling importing to gnumed
Date: Wed, 07 Mar 2007 07:13:03 +0800

FYI, a python dbf table dump into a file using in importers/
takes about 12 seconds for the patients table using the unix time command
to profile.

A C++ program takes about 1.7 seconds, and a second version of it,
which moves the dump function into the class, takes 2.7 seconds.

When gnome-terminal is involved, and dumping is done to the terminal output,
it takes about 2 minutes.

unix top function shows 87% of CPU is used  up by gnome-terminal, whilst
8% of CPU is used by the C++ program. 

using root user to invoke  nice --19  to try to make the C++ program use up 
CPU doesn't work ( as expected), as gnome-terminal is part of the output
pipeline, but the C++ program may gain 1% CPU .

optimizing with gcc -O3  doesn't do much either.

Pros and cons about C++ vs python: 6 times faster, at cost of easier to cause
segmentation fault ( trying to write to a memory location , outside of
the allocated data segment to the program;  apparently x86 uses segmentation, 
which is a form of  memory protection ; segments
have a location, and a segment size; a code segment and data segment 
are allocated to each program ).
  The pro of C++ , is that awareness of avoiding the complications of managing
memory allocation means the class interface tries as much as possible to 
get the caller to manage the buffer space, or the buffer space is allocated
on the stack. So the program tends to use less resources ( probably). 

still nice to have the newbie feeling.

Attachment: dbf_c.cpp
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]