3 ms·
Going into it I assumed this article was about data structures like the PHP "array", which are basically ordered hashtables that allow the programmer to treat t
by gfodor 11y ago
Going into it I assumed this article was about data structures like the PHP "array", which are basically ordered hashtables that allow the programmer to treat them like either lists or hashes depending on context and still get reasonable performance. (I haven't seen this pattern used much elsewhere, has anyone?)
- Rusky 11y agoLua tables are similar- they're nominally hash tables but are often used as arrays (including a length operator), and a few versions ago they added an optimization where small integer keys are stored in an actual linear array.
- Franciscouzo 11y agoThe optimization is actually for contiguous integer keys, starting from 1.
- arikrak 11y agoAren't any hashes that keep track of order like that? (I.e. how's that different than objects in javascript, hashes in ruby, OrderedDicts in python and LinkedHashmaps in java?)
- olalonde 11y agoIn Javascript, object properties are not ordered: http://stackoverflow.com/a/5525820/96855 http://stackoverflow.com/a/5525820/96855. The Map object would be closer: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- deleted 11y ago[deleted]