Skip to content

Instantly share code, notes, and snippets.

@ctjlewis
ctjlewis / private.txt
Created August 15, 2024 05:01
Bytecode for public properties vs public fields.
This file has been truncated, but you can view the full file.
class WithPrivate {
#field = 0;
increment() { this.#field++; }
get() { return this.#field; }
}
const obj = new WithPrivate();
const iterations = 1000000; // 1 million iterations
for (let i = 0; i < iterations; i++) {
This file has been truncated, but you can view the full file.
2024-04-22T22:25:39.9996432Z [USER]
2024-04-22T22:25:39.9997091Z 0:0 1:0 2:0 3:0 4:1 5:0 6:0 7:1 8:0 9:0
2024-04-22T22:25:39.9997788Z 1
2024-04-22T22:25:39.9998545Z 9
2024-04-22T22:25:39.9998789Z
2024-04-22T22:25:39.9999054Z [ASSISTANT]
2024-04-22T22:25:40.0018472Z
2024-04-22T22:25:40.0020039Z ┌──────────────┬─────────────────────────────────────────┐
2024-04-22T22:25:40.0021171Z │ │ Values │