Re: Euphoria Compilers Available Soon

new topic     » goto parent     » topic index » view thread      » older message » newer message

"Mike the Spike" wrote:

> A sequence is just an array that can
> have other elements appended/prepended
> to it.

OK. just for grins let's assume that you create a 'sequence' as a list of
pointers:

   { ptr1, ptr2, ptr3, ptr4 ... ptrN }

Right away, you are slower than RDS when working with sequences, because in
order to get the value at the other end of the pointer, you need to fetch
the value the pointer is pointing to. In contrast, RDS uses one of the 32
bits to flag if the value is a number, so when dealing with sequences filled
with numbers, they have one less fetch than you do, right off the bat.

This ignores the obvious question: what kind of data is your pointer
pointing to, anyway? It's not enough that you can fill the sequence with
arbitrary data; you need to be able to read it out. But simply storing the
pointer is lossy - you've got to store a data type flag somewhere, either in
the sequence or with the data. I'll just gloss over this important point,
and move on to maintaining data integtity in structures: something your
approach doesn't do. Methinks that this will slow down your benchmark a bit
more.

Even more importantly, what happens when you have something like this?

   s1 = { 1,2 }
   s2 = { s1 }

If you implement it like this:

   s1 --> { ptr1, ptr2 }
   s2 --> { ptr3 }
   ptr1 --> 1
   ptr2 --> 2
   ptr3 --> s1

then your code *breaks* when an operation like this is performed:

   s[2] = 3

because the data structure now looks like this:

   s1 --> { ptr1, ptr4 }
   s2 --> { ptr3 }
   ptr1 --> 1
   ptr2 --> 2
   ptr3 --> s1
   ptr4 --> 3

and the sequences contain:

   s1 = { 1, 3 }
   s2 = { { 1, 3 } }

instead of:

   s1 = { 1, 3 }
   s2 = { { 1, 2 } }

After you finish adding reference counting, indirection and garbage
collection to your code, try performing those benchmarks again - I don't
think even the fanciest compiler is going to be much help in running faster
than Euphoria.

-- David Cuny

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu