speed on default functor

Started by newdep, November 27, 2008, 01:29:35 PM

Previous topic - Next topic

newdep

Hi lutz,



-> (setq biglist:biglist '( a b c d e ... ... ... ))

(a b c d e ... ... ...)

-> (setq referer biglist)

biglist

->



Do i understand it correclty that when it now comes to speed on this "list"

working on the 'referer results in speed performance? Or can i now also work

on the functor biglist, because its a functor?



(So actualy the 'referer is a pointer based list?)
-- (define? (Cornflakes))

Lutz

#1
QuoteSo actualy the 'referer is a pointer based list?


Yes:




newLISP v.9.9.95 on OSX IPv4 UTF-8, execute 'newlisp -h' for more info.

> (setq biglist:biglist '( a b c d e ... ... ... ))
(a b c d e ... ... ...)
> (setq referer biglist)
biglist
> (setf (referer 0) 'Z)
Z
> biglist:biglist
(Z b c d e ... ... ...)
> referer:biglist
(Z b c d e ... ... ...)
>

newdep

#2
So if creating a refererence of the default-function results in reference

data handling this means that also for hash tables its better to work

on a referer of the default-function then on the default-function itself?

(Actualy its better to always work on the referer..?)



What about the speed difference between array-lists and the referer or

what if the default-function would be an array with a referer? Is that

even quicker?
-- (define? (Cornflakes))

Lutz

#3
There is no measurable speed difference between using the original symbol or a referrer, no matter if it is a hash, array or list which is referred.



Here is as hort textual description how the newLISP evaluator looks at this expression:


(Foo x)

- Foo gets evaluated and turns up one of five things:



- the context Foo -> proceed with default functor Foo:Foo

- another context Ctx -> proceed with default functor Ctx:Ctx

- a list -> proceed with implicit indexing of a list

- an array -> proceed with implicit indexing of an array

- a string -> proceed with implicit indexing of a string



Foo:Foo -> check the contents of Foo:Foo

Ctx:Ctx -> check the contents of Ctx:Ctx



IF nil -> do hashing with key-string in x

IF list -> do implicit indexing with with number-index in x

IF array -> do implicit indexing with number-index in x

IF string -> do implicit indexing with number-index in x