From: Pascal J. Bourguignon on
mdj <mdj.mdj(a)gmail.com> writes:

> On Jan 5, 5:52�am, p...(a)informatimago.com (Pascal J. Bourguignon)
> wrote:
>> Kenneth Tilton <kentil...(a)gmail.com> writes:
>> > PWUAHAHAHAHA!!! What made you choose slot A? PWUAHAHAHHAHAAH!!!!
>>
>> aref, or a structure slot access could involve a multiplication, which
>> is often slower tha a few memory accesses (as long as the cache is hit).
>
> For aref, that's true (unless the index is a power of two into a one
> dimensional array) but not for structures. There's no point at all in
> having generated code recompute a value that is derivable at structure
> definition time.

Yes. But still, some implementation just do that. See the
disassembly I posted.

--
__Pascal Bourguignon__ http://www.informatimago.com/
From: mdj on
On Jan 5, 10:45 am, p...(a)informatimago.com (Pascal J. Bourguignon)
wrote:

> > For aref, that's true (unless the index is a power of two into a one
> > dimensional array) but not for structures. There's no point at all in
> > having generated code recompute a value that is derivable at structure
> > definition time.
>
> Yes.  But still, some implementation just do that.  See the
> disassembly I posted.

And some don't:

SBCL 1.0.30 (Linux x86_64) :

(let ((s (make-ss :a 42))) (time (loop :repeat 100000 :do (ss-a s))))

Evaluation took:
0.000 seconds of real time
0.000000 seconds of total run time (0.000000 user, 0.000000 system)
100.00% CPU
100,746 processor cycles
0 bytes consed

(let ((s (make-sl :a 42))) (time (loop :repeat 100000 :do (sl-a s))))

Evaluation took:
0.000 seconds of real time
0.001000 seconds of total run time (0.001000 user, 0.000000 system)
100.00% CPU
699,300 processor cycles
0 bytes consed



Your example only shows that CLISP has a crummy implementation of
structures, not that plists can outperform structures below a certain
number of members.

An optimal implementation will contain less memory references for
structures regardless of machine architecture, and will be faster.
period.

Matt
From: Kenneth Tilton on
mdj wrote:
> On Jan 5, 10:45 am, p...(a)informatimago.com (Pascal J. Bourguignon)
> wrote:
>
>>> For aref, that's true (unless the index is a power of two into a one
>>> dimensional array) but not for structures. There's no point at all in
>>> having generated code recompute a value that is derivable at structure
>>> definition time.
>> Yes. But still, some implementation just do that. See the
>> disassembly I posted.
>
> And some don't:
>
> SBCL 1.0.30 (Linux x86_64) :
>
> (let ((s (make-ss :a 42))) (time (loop :repeat 100000 :do (ss-a s))))
>
> Evaluation took:
> 0.000 seconds of real time
> 0.000000 seconds of total run time (0.000000 user, 0.000000 system)
> 100.00% CPU
> 100,746 processor cycles
> 0 bytes consed
>
> (let ((s (make-sl :a 42))) (time (loop :repeat 100000 :do (sl-a s))))
>
> Evaluation took:
> 0.000 seconds of real time
> 0.001000 seconds of total run time (0.001000 user, 0.000000 system)
> 100.00% CPU
> 699,300 processor cycles
> 0 bytes consed
>
>
>
> Your example only shows that CLISP has a crummy implementation of
> structures, not that plists can outperform structures below a certain
> number of members.

Where has anybody timed a plist? I see no timings of the plist
implementation. Does everyone know what is a plist? Am I the only one
that understands that PB quickly abandoned "plists are just as fast" as
soon as he realized his gaffe and pretended the issue was defstructs of
type list? Is the Tiger Woods implosion bigger than OJ's?

kenneth
---
http://www.stuckonalgebra.com
From: mdj on
On Jan 5, 12:14 pm, Kenneth Tilton <kentil...(a)gmail.com> wrote:

> Where has anybody timed a plist? I see no timings of the plist
> implementation. Does everyone know what is a plist? Am I the only one
> that understands that PB quickly abandoned "plists are just as fast" as
> soon as he realized his gaffe and pretended the issue was defstructs of
> type list?

I just assume list based structs are plists and not alists and that
the performance is representative. I feel no compulsion to prove what
should be obvious ...

> Is the Tiger Woods implosion bigger than OJ's?

I think they inserted entirely different objects into the respective
women, so it's difficult to do an objective comparison
From: Ron Garret on
In article
<d50e5346-8eef-457c-929e-4cce045a4e17(a)j5g2000yqm.googlegroups.com>,
mdj <mdj.mdj(a)gmail.com> wrote:

> On Jan 5, 12:14 pm, Kenneth Tilton <kentil...(a)gmail.com> wrote:
>
> > Where has anybody timed a plist? I see no timings of the plist
> > implementation. Does everyone know what is a plist? Am I the only one
> > that understands that PB quickly abandoned "plists are just as fast" as
> > soon as he realized his gaffe and pretended the issue was defstructs of
> > type list?
>
> I just assume list based structs are plists and not alists

Why do you think they have to be one or the other?

rg