Created
August 27, 2023 01:57
-
-
Save Chriscbr/fa69e5f7f35d5aa4dc312dd7025952b1 to your computer and use it in GitHub Desktop.
constructs benchmarking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Construct } from "constructs"; | |
class App extends Construct { | |
constructor() { | |
super(undefined as any, ''); | |
} | |
} | |
class L0 extends Construct { | |
constructor(scope: Construct, id: string) { | |
super(scope, id); | |
} | |
} | |
class L1 extends Construct { | |
constructor(scope: Construct, id: string) { | |
super(scope, id); | |
for (let i = 0; i < 100; i++) { | |
new L0(this, `l1-${i}`); | |
} | |
} | |
} | |
class L2 extends Construct { | |
constructor(scope: Construct, id: string) { | |
super(scope, id); | |
for (let i = 0; i < 100; i++) { | |
new L1(this, `l1-${i}`); | |
} | |
} | |
} | |
class L3 extends Construct { | |
constructor(scope: Construct, id: string) { | |
super(scope, id); | |
for (let i = 0; i < 100; i++) { | |
new L2(this, `l2-${i}`); | |
} | |
} | |
} | |
console.time("construct"); | |
const app = new App(); | |
new L3(app, 'l3'); | |
console.timeEnd("construct"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment