Map with integer key

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
IceSoft
Addict
Addict
Posts: 1616
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: Map with integer key

Post by IceSoft »

Usw Arrays.
Or your own linked list.
Or ist tihis mit Right?
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: Map with integer key

Post by Tenaja »

IceSoft wrote: Sun May 30, 2021 6:12 pm Usw Arrays.
Or your own linked list.
Or ist tihis mit Right?
Arrays are no good when you don't know the size of data. And, if the number aren't contiguous, a trie is more RAM efficient. Obviously, that's moot if there's only 1k, but of you are running into ram concerns, it matters.
User avatar
idle
Always Here
Always Here
Posts: 5095
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Map with integer key

Post by idle »

Squint technically hoses all over a Map, don't be fooled by the timings as they're not really a fair fight.

A sized map, you know in advance how many items you need to store
Items 1000000
Squint Numeric Set 794 ms
Map Set 527 ms
Squint numeric Get 399 ms
Map Get 513 ms
=========================
Squint Set Ratio 1.507 slower
Squint Get Ratio 1.286 faster
=========================
Key Input Size 7.63 mb
Squint Memory Size 25.71 mb
Overhead 3.37 bytes input
Map Size ~ 49.70mb
vs a dynamically sized map, Result Maps not very dynamic, it only took 10 minutes for the map.
Items 1000000
Squint Numeric Set 566 ms
Map Set 296708 ms
Squint numeric Get 811 ms
Map Get 659250 ms
=========================
Squint Set Ratio 0.002 slower
Squint Get Ratio 812.885 faster
=========================
Key Input Size 7.63 mb
Squint Memory Size 25.71 mb
Overhead 3.37 bytes input
Map Size ~ 49.70mb
Rinzwind
Enthusiast
Enthusiast
Posts: 638
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: Map with integer key

Post by Rinzwind »

There's barely ever a reply (let alone implementation) from head quarters so no difference there. A point to improve upon me think. Anyway, keep wishing :)

Request is originally from 2019 too...
Post Reply