[Haskell] ANNOUNCE: FPS - FastPackedStrings 0.2

Bulat Ziganshin bulat.ziganshin at gmail.com
Thu Apr 20 06:18:32 EDT 2006

Hello Donald,

Thursday, April 20, 2006, 1:06:38 PM, you wrote:

>> this lib should be slower than your on small strings due to ForeignPtr
>> inefficiency

> Do you have some sketches of ByteArray# represenations?
> I'm very happy to change the representation if it makes things more time
> or space efficient. 

you should see at the jhc's PackedString implementation that uses
UArray (which is internally ByteArray#). his implementation also don't
use additional Ints - array size is stored as part of UArray structure
and O(1) substr operation is just not exists (instead, it is O(n) with

as i said, this can be extended to support List-like interface for ANY
arrays, that is the very useful thing. if you will implement this,
then we will only need utf-8 wrapper around UArray Int Word8 for
implementing packed Unicode strings (and Latin1/UCS-2/UCS-4 strings
will work just as unboxed arrays of Word8/Word16/Word32)

you can compare speed and memory requirements of ForeignPtr and
ByteArray# solutions by comparing jhc's module with Simon's utf-8
implementation - both are not such greatly optimized as your lib, both
uses utf-8. please use large number of typical strings (with size of
10-100) for real-world comparison, comparing on 20mb strings is not

i can write disk traversing algorithm (like ls-lR) for some sort of
real app, to make testing more realistic

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Libraries mailing list