From: fred@extasy.enet.dec.com (Fred Kleinsorge)
Subject: Re: char access is not so fast (:-<)
Date: 1995/05/05 [thread overview]
Message-ID: <3oda9h$f2g@nntpd.lkg.dec.com> (raw)
In-Reply-To: danpop.799413227@rscernix
In article <danpop.799413227@rscernix>, danpop@afsmail.cern.ch (Dan Pop)
writes:
>In <KUGE.95May2125112@k1ss.strl.nhk.or.jp> kuge@strl.nhk.or.jp (Tetsuro
>KUGE) writes:
>
>>Hi, speedsters (^^;),
>>
>>It is seemed the access to char *array on Alpha CPU
>>is NOT so faster than the "slower" chips of Sparc etc.
>>
>>On the Alpha server 4/275 with OSF/1 V.3.0B,
>>the cc opitons -O* does not improve the situation (:-<).
>>
>>Is it my misunderstanding ?
>
>It's not your misunderstanding, it's the Alpha architecture not being
>able to access bytes. The only data sizes that can be directly
>accessed
>by Alpha are 32 and 64 bit. For characters and short int's there is a
>certain overhead, as the accesses have to be implemented in software
>(with
>more than one instruction :-)
>
The Alpha rchitecture doesn't deal with bytes, it deals with blocks
of 4 or 8 bytes at minimum. It leaves the handling of bytes to the
compilers. How good the generated code from the compiler is depends
on: the quality of the compiler, the quality of the source code, and
the constraints on the code and the compiler.
The compilers have gotten better about partial word manipulation,
but in general you will always get better performance if your code
is written to deal in terms of 32 or 64 bit ints, and do the
byte manipulation by hand.
The general problem is that the generated code tends to be "safe"
that is, it's guaranteed to work, and not generate alignment faults.
So what you see is code that will have sequences like:
LDQ_U R21, (R0)
EXTBL R21, R0, R0
Just to simply fetch a byte in a foo[bar] array type operation.
In general the generated code is fast enough for most purposes, and
getting better. However, in performance critical code, like the
inner loop of say a image operation - you can get 2x performance
increases by using pointers to int32 or int64 data, and shifting,
masking, and ORing by hand. Most of the performance win comes from
doing aligned fetching of the data once, and then doing operations
on that block of data in registers.
--
+--------------------------------------+
Fred Kleinsorge | All opinions expressed are mine, and |
kleinsorge@star.enet.dec.com | may not reflect those of my employer |
+--------------------------------------+
next prev parent reply other threads:[~1995-05-05 4:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-05-02 4:00 char access is not so fast (:-<) Tetsuro KUGE
1995-05-02 4:00 ` Dan Pop
1995-05-05 4:00 ` Fred Kleinsorge [this message]
1995-05-02 4:00 ` Stephen Hoffman
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox