[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Portable Code (am I dreaming? :))
From:       Clarence Dang <CTRL_CD () bigpond ! com>
Date:       2002-01-26 10:51:43
[Download RAW message or body]

On Sat, 26 Jan 2002 10:13, shaheed wrote:
> Clarence,
> 
> Nicolas is right that the performance is not an issue. Getting it right is
> much more important. I bet the time spent in the mword read() functions is
> less than 1% of the time taken to load a Word document. Consider for
> example how many instructions it takes to render a single letter.
> 
Before comitting to CVS, my code read in one byte at a time.
The version I have in CVS, reads a thousand bytes at a time and was found to be 2x \
faster. So this is what I plan to do:

#if defined (I_HAVE_A_32_BIT_X86_SYSTEM)
	// do fast, i386, unportable read functions
#else
	// do slower, portable, one-byte-at-a-time functions
#endif

That way I can have the best of both worlds! :)
Is this a good or a bad idea (all my ideas seem to have flaws in them :)).
Only problem is: does anyone know where I can find such a #define in config.h or \
similar?

> > Can all the packing/alignment business be avoided if I get rid of
> > sizeof()s and instead have #define <structure name>_SIZEOF everywhere
> > instead?
> 
> Yes. That's exactly my plan.  Nicolas, I think that Clarence is talking
> about the packing/alignment crap in the ms word filter. I did that stuff
> precisely so that I could use sizeof() in certain places. It would have
> worked just fine too, if only certain stupid compilers (e.g. on Irix) had
> controls over packing and alignment!
> 
I was just browsing through your code:
#ifndef __GNUC__
#define __attribute__(a)
#pragma pack(1)
#endif
Even though both of us will be removing #pragma pack(1) in our code, I'm just \
wondering why it says #ifndef instead of #ifdef (only GNU supports #pragma pack, I \
remember being told by Nicolas, I think)?

Thanks!
Clarence
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic