Website is upgrading. We will get back soon with latest updates. Thanks for your kind support.

Search

Suggested keywords:

[AskJS] v8 question: are small integers pooled?

post-title
image

was looking at this V8 design doc where it has a section for Constant Pool Entries

it says

Constant pools are used to store heap objects and small integers that are referenced as constants in generated bytecode. and

… Small integers and the strong referenced oddball type’s have bytecodes to load them directly and do not go into the constant pool.

So I am confused: are small integers pooled or not?

My understanding is that it is not worth it pooling small integers if sizeof(int) < sizeof(int *) – because it is cheaper to just copy the actual integer instead of copying the pointer that points to the integer in the constant pool. Also variables that hold integers can be optimised to be stored directly in CPU registers and skip being allocated in memory first.

Please correct me if I am wrong.

You should write because you love the shape of Flow and sentences and the creation of different words on a page.
Social Media

Leave a Reply

Subscribe

to Our Newsletter