Subject: [clisp-list] read-integer, read-float, write-integer and write-fl oat bug + more

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Thu Dec 12 10:50:07 2002

Bernard Urban wrote:
>I insist on not using elt_nreverse(), which has the bad effect of beeing
>very costly (on files of 1Mb size full of double-float, the additional
>time cost is about 30% compared to the 2.27 version).

It may be very costly, but its use seems completely wrong. It NREVERSE a bit-vector, while the comment say to *byte swap*. That's not at all the same manipulation of data.

  if (BIG_ENDIAN_P ? !endianness : endianness) # Byte-Swap the data.
    elt_nreverse(bitbuffer,0,bytesize);

elt_nreverse doesn't byte swap on a bit buffer. It may do so only for arrays of element-type (unsigned-byte 8), not arrays of bits. For u-8, elt_nreverse() should be as efficient as inlined code.

Talking about microcycles, bytesize would have been better declared as uintBWL for some systems (Intel not affected since prefers all 32bit ints), and you have to hope for memcpy(...,sizeof(ffloatjanus)) to be inlined. CLISP has dotimespL() and doconsttimes() for such loops.

Again, constant folding rules loops and one would obtain more speed if there were a function to parse a whole array of floats or ints at once. That's what I call the principle of working on blocks.

Thanks for discovering and reporting this.

	Jorg Hohle.

---

From: Sam Steingold <[email-masked]>
Date: Thu Dec 12 13:32:04 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] read-integer, read-float, write-integer and write-fl oat bug + more"
> * Sent on Thu, 12 Dec 2002 19:49:39 +0100
> * Honorable "Hoehle, Joerg-Cyril" <[email-masked]> writes:
>
> It may be very costly, but its use seems completely wrong. It NREVERSE
> a bit-vector, while the comment say to *byte swap*. That's not at all
> the same manipulation of data.

this explains the performance hit.
thanks!

this is now fixed in the CVS.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Computers are like air conditioners: they don't work with open windows!