Re: adjustable array vs hash-table
- From: Pascal Costanza <pc@xxxxxxxxx>
- Date: Wed, 30 Jan 2008 23:17:51 +0100
Slobodan Blazeski wrote:
I could use a hash-table or an adjustable array. Considering the keys
of the hash-table are equal to indices in the array 0.1.2.3.4...
functionality is the same. So which one is more efficient at
a. Expanding when new elements are added when container can't hold
them
b. Accessing elements via index / key.
Hard to tell, because this is probably implementation-dependent. But writing a few simple benchmarks shouldn't be too hard. The predefined 'time macro is your friend. (Put the benchmark in a function, and time a simple call to that function. Putting more complex code inside an invocation of time seems to have a negative effect on results.)
Pascal
--
1st European Lisp Symposium (ELS'08)
http://prog.vub.ac.be/~pcostanza/els08/
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
.
- References:
- adjustable array vs hash-table
- From: Slobodan Blazeski
- adjustable array vs hash-table
- Prev by Date: adjustable array vs hash-table
- Next by Date: Re: Paul Graham's Arc is released today... what is the long term impact?
- Previous by thread: adjustable array vs hash-table
- Next by thread: Re: adjustable array vs hash-table
- Index(es):
Relevant Pages
|