Arrays are probably your best bet (but don't ever `delete` elements, or
change the size of your array!).
I don't understand what you mean by "placeholder". But FWIW, array keys
(i.e., small integers) are usually unboxed, i.e., not heap-allocated.
A general advise, though: don't be over-concerned
I'll just point this out: low level optimization like that is very
unintuitive.
Game engines often use object pools to avoid allocation and GC, since even
a single `malloc` is sometimes too expensive. There's other ways of
reducing GC as well, such as persistence (like persistent data structures -
Thanks Andreas, that's helpful to know. In general, is there some way to
keep a list (adding removing things over time) while avoiding GC?
For example, I thought I could place and remove items into a list (f.e. Set
or Map, while having my own references to all the items and the list and
outside of
The `undefined` value is represented in exactly the same way as `true`,
`false`, and `null` in V8. They're so called "oddballs" internally, global
values that are neither allocated nor freed.
Either way, the key/values of a (regular) map do not keep anything alive
about the map. Adding or removing
> The only v8 shell I have lying around is too old (3.14.5.10) to have Set,
so I can't tell you what it would do.
On my first attempt, I noticed 8 Major GCs:
https://cloud.githubusercontent.com/assets/297678/15036715/f41ea4d4-1247-11e6-8823-f153c3c1b7bb.png
On second attempt, no Major GCs:
https:
On 5/4/16 5:03 PM, Steve Fink wrote:
The only v8 shell I have lying around is too old (3.14.5.10) to have
Set, so I can't tell you what it would do.
I have v8 "4.8.0 (candidate)" (meaning whatever rev I checked out), and
it does 1163 minor ("Scavenge") GCs on your testcase. It also does 1163
On 05/04/2016 01:43 PM, /#!/JoePea wrote:
For example, I have some code that uses a Map just to keep a
collection of things (the keys) but values are not important, so they
are undefined, like this:
```js
let something = {}
let otherThing = {}
let m = new Map
m.set(something)
m.set(
otherTh
For example, I have some code that uses a Map just to keep a collection of
things (the keys) but values are not important, so they are undefined, like
this:
```js
let something = {}
let otherThing = {}
let m = new Map
m.set(something)
m.set(
otherThing
)
```
where the values for those object k
8 matches
Mail list logo