Repository: node
Issue: Reduce the promise overhead in the ESM loader
Labels: performance,loaders

As a follow up of https://github.com/nodejs/node/issues/50356, one of the problem of using the current ESM loader as the central loader is that it creates a lot of noisy promises during loading - even when loading a completely synchronous graph. For example, when loading a completely empty .mjs file, it creates 66 promises (using https://github.com/nodejs/node/pull/50899)

<details>
<summary>See log</summary>

```
[--trace-promises] created promise #0
    at loadESM (node:internal/process/esm_loader:16:16)
    at runMainESM (node:internal/modules/run_main:105:21)
    at executeUserEntryPoint (node:internal/modules/run_main:138:5)
    at node:internal/main/run_main_module:28:49

[--trace-promises] created promise #1
    at import (node:internal/modules/esm/loader:327:15)
    at node:internal/modules/run_main:106:28
    at loadESM (node:internal/process/esm_loader:28:13)
    at runMainESM (node:internal/modules/run_main:105:21)
    at executeUserEntryPoint (node:internal/modules/run_main:138:5)
    at node:internal/main/run_main_module:28:49

[--trace-promises] created promise #2
    at getModuleJob (node:internal/modules/esm/loader:239:21)
    at import (node:internal/modules/esm/loader:328:34)
    at node:internal/modules/run_main:106:28
    at loadESM (node:internal/process/esm_loader:28:13)
    at runMainESM (node:internal/modules/run_main:105:21)
    at executeUserEntryPoint (node:internal/modules/run_main:138:5)
    at node:internal/main/run_main_module:28:49

[--trace-promises] promise #2 created promise #3
    at getModuleJob (node:internal/modules/esm/loader:240:38)
    at import (node:internal/modules/esm/loader:328:34)
    at node:internal/modules/run_main:106:28
    at loadESM (node:internal/process/esm_loader:28:13)
    at runMainESM (node:internal/modules/run_main:105:21)
    at executeUserEntryPoint (node:internal/modules/run_main:138:5)
    at node:internal/main/run_main_module:28:49

[--trace-promises] resolved promise #3
    at getModuleJob (node:internal/modules/esm/loader:240:38)
    at import (node:internal/modules/esm/loader:328:34)
    at node:internal/modules/run_main:106:28
    at loadESM (node:internal/process/esm_loader:28:13)
    at runMainESM (node:internal/modules/run_main:105:21)
    at executeUserEntryPoint (node:internal/modules/run_main:138:5)
    at node:internal/main/run_main_module:28:49

[--trace-promises] promise #3 created promise #4
    at getModuleJob (node:internal/modules/esm/loader:240:38)
    at import (node:internal/modules/esm/loader:328:34)
    at node:internal/modules/run_main:106:28
    at loadESM (node:internal/process/esm_loader:28:13)
    at runMainESM (node:internal/modules/run_main:105:21)
    at executeUserEntryPoint (node:internal/modules/run_main:138:5)
    at node:internal/main/run_main_module:28:49

[--trace-promises] promise #2 created promise #5
    at import (node:internal/modules/esm/loader:328:34)
    at node:internal/modules/run_main:106:28
    at loadESM (node:internal/process/esm_loader:28:13)
    at runMainESM (node:internal/modules/run_main:105:21)
    at executeUserEntryPoint (node:internal/modules/run_main:138:5)
    at node:internal/main/run_main_module:28:49

[--trace-promises] promise #1 created promise #6
    at loadESM (node:internal/process/esm_loader:28:13)
    at runMainESM (node:internal/modules/run_main:105:21)
    at executeUserEntryPoint (node:internal/modules/run_main:138:5)
    at node:internal/main/run_main_module:28:49

[--trace-promises] created promise #7
    at handleMainPromise (node:internal/modules/run_main:114:33)
    at runMainESM (node:internal/modules/run_main:105:3)
    at executeUserEntryPoint (node:internal/modules/run_main:138:5)
    at node:internal/main/run_main_module:28:49

[--trace-promises] promise #0 created promise #8
    at handleMainPromise (node:internal/modules/run_main:120:5)
    at runMainESM (node:internal/modules/run_main:105:3)
    at executeUserEntryPoint (node:internal/modules/run_main:138:5)
    at node:internal/main/run_main_module:28:49

[--trace-promises] created promise #9
    at node:internal/modules/esm/module_job:29:25
    at compileForInternalLoader (node:internal/bootstrap/realm:401:7)
    at requireBuiltin (node:internal/bootstrap/realm:432:14)
    at #createModuleJob (node:internal/modules/esm/loader:302:23)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] resolved promise #9
    at node:internal/modules/esm/module_job:29:25
    at compileForInternalLoader (node:internal/bootstrap/realm:401:7)
    at requireBuiltin (node:internal/bootstrap/realm:432:14)
    at #createModuleJob (node:internal/modules/esm/loader:302:23)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] created promise #10
    at moduleProvider (node:internal/modules/esm/loader:291:7)
    at ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] created promise #11
    at load (node:internal/modules/esm/loader:405:13)
    at moduleProvider (node:internal/modules/esm/loader:291:56)
    at ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] created promise #12
    at defaultLoad (node:internal/modules/esm/load:110:27)
    at load (node:internal/modules/esm/loader:409:13)
    at moduleProvider (node:internal/modules/esm/loader:291:56)
    at ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] created promise #13
    at getSource (node:internal/modules/esm/load:40:25)
    at defaultLoad (node:internal/modules/esm/load:138:40)
    at load (node:internal/modules/esm/loader:409:13)
    at moduleProvider (node:internal/modules/esm/loader:291:56)
    at ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] created promise #14
    at readFile (node:internal/fs/promises:1219:24)
    at getSource (node:internal/modules/esm/load:46:20)
    at defaultLoad (node:internal/modules/esm/load:138:40)
    at load (node:internal/modules/esm/loader:409:13)
    at moduleProvider (node:internal/modules/esm/loader:291:56)
    at ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] created promise #15
    at open (node:internal/fs/promises:624:20)
    at readFile (node:internal/fs/promises:1228:20)
    at getSource (node:internal/modules/esm/load:46:20)
    at defaultLoad (node:internal/modules/esm/load:138:40)
    at load (node:internal/modules/esm/loader:409:13)
    at moduleProvider (node:internal/modules/esm/loader:291:56)
    at ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] created promise #16
    at open (node:internal/fs/promises:629:13)
    at readFile (node:internal/fs/promises:1228:20)
    at getSource (node:internal/modules/esm/load:46:20)
    at defaultLoad (node:internal/modules/esm/load:138:40)
    at load (node:internal/modules/esm/loader:409:13)
    at moduleProvider (node:internal/modules/esm/loader:291:56)
    at ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] promise #16 created promise #17
    at open (node:internal/fs/promises:628:31)
    at readFile (node:internal/fs/promises:1228:20)
    at getSource (node:internal/modules/esm/load:46:20)
    at defaultLoad (node:internal/modules/esm/load:138:40)
    at load (node:internal/modules/esm/loader:409:13)
    at moduleProvider (node:internal/modules/esm/loader:291:56)
    at ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] promise #17 created promise #18
    at open (node:internal/fs/promises:628:31)
    at readFile (node:internal/fs/promises:1228:20)
    at getSource (node:internal/modules/esm/load:46:20)
    at defaultLoad (node:internal/modules/esm/load:138:40)
    at load (node:internal/modules/esm/loader:409:13)
    at moduleProvider (node:internal/modules/esm/loader:291:56)
    at ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] promise #15 created promise #19
    at readFile (node:internal/fs/promises:1228:20)
    at getSource (node:internal/modules/esm/load:46:20)
    at defaultLoad (node:internal/modules/esm/load:138:40)
    at load (node:internal/modules/esm/loader:409:13)
    at moduleProvider (node:internal/modules/esm/loader:291:56)
    at ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] promise #14 created promise #20
    at getSource (node:internal/modules/esm/load:46:20)
    at defaultLoad (node:internal/modules/esm/load:138:40)
    at load (node:internal/modules/esm/loader:409:13)
    at moduleProvider (node:internal/modules/esm/loader:291:56)
    at ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] promise #13 created promise #21
    at defaultLoad (node:internal/modules/esm/load:138:40)
    at load (node:internal/modules/esm/loader:409:13)
    at moduleProvider (node:internal/modules/esm/loader:291:56)
    at ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] promise #12 created promise #22
    at load (node:internal/modules/esm/loader:409:13)
    at moduleProvider (node:internal/modules/esm/loader:291:56)
    at ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] promise #11 created promise #23
    at moduleProvider (node:internal/modules/esm/loader:291:56)
    at ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] created promise #24
    at link (node:internal/modules/esm/module_job:75:18)
    at ModuleJob (node:internal/modules/esm/module_job:97:19)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] promise #10 created promise #25
    at link (node:internal/modules/esm/module_job:76:32)
    at ModuleJob (node:internal/modules/esm/module_job:97:19)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] promise #24 created promise #26
    at ModuleJob (node:internal/modules/esm/module_job:100:5)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] resolved promise #2
    at getModuleJob (node:internal/modules/esm/loader:241:17)

[--trace-promises] resolved promise #4
[--trace-promises] created promise #27
    at run (node:internal/modules/esm/module_job:213:12)
    at import (node:internal/modules/esm/loader:329:40)

[--trace-promises] created promise #28
    at _instantiate (node:internal/modules/esm/module_job:114:21)
    at instantiate (node:internal/modules/esm/module_job:109:32)
    at run (node:internal/modules/esm/module_job:214:16)
    at import (node:internal/modules/esm/loader:329:40)

[--trace-promises] created promise #29
    at addJobsToDependencyGraph (node:internal/modules/esm/module_job:116:38)
    at _instantiate (node:internal/modules/esm/module_job:124:11)
    at instantiate (node:internal/modules/esm/module_job:109:32)
    at run (node:internal/modules/esm/module_job:214:16)
    at import (node:internal/modules/esm/loader:329:40)

[--trace-promises] promise #24 created promise #30
    at addJobsToDependencyGraph (node:internal/modules/esm/module_job:121:46)
    at _instantiate (node:internal/modules/esm/module_job:124:11)
    at instantiate (node:internal/modules/esm/module_job:109:32)
    at run (node:internal/modules/esm/module_job:214:16)
    at import (node:internal/modules/esm/loader:329:40)

[--trace-promises] promise #29 created promise #31
    at _instantiate (node:internal/modules/esm/module_job:124:11)
    at instantiate (node:internal/modules/esm/module_job:109:32)
    at run (node:internal/modules/esm/module_job:214:16)
    at import (node:internal/modules/esm/loader:329:40)

[--trace-promises] promise #28 created promise #32
    at run (node:internal/modules/esm/module_job:214:16)
    at import (node:internal/modules/esm/loader:329:40)

[--trace-promises] promise #27 created promise #33
    at import (node:internal/modules/esm/loader:329:40)

[--trace-promises] resolved promise #5
[--trace-promises] resolved promise #16
[--trace-promises] resolved promise #17
[--trace-promises] resolved promise #15
    at open (node:internal/fs/promises:628:10)

[--trace-promises] resolved promise #18
[--trace-promises] created promise #34
    at readFileHandle (node:internal/fs/promises:500:30)
    at readFile (node:internal/fs/promises:1229:24)

[--trace-promises] created promise #35
    at readFileHandle (node:internal/fs/promises:508:13)
    at readFile (node:internal/fs/promises:1229:24)

[--trace-promises] promise #35 created promise #36
    at readFileHandle (node:internal/fs/promises:507:28)
    at readFile (node:internal/fs/promises:1229:24)

[--trace-promises] promise #36 created promise #37
    at readFileHandle (node:internal/fs/promises:507:28)
    at readFile (node:internal/fs/promises:1229:24)

[--trace-promises] created promise #38
    at handleFdClose (node:internal/fs/promises:415:29)
    at readFile (node:internal/fs/promises:1229:10)

[--trace-promises] promise #34 created promise #39
    at handleFdClose (node:internal/fs/promises:416:10)
    at readFile (node:internal/fs/promises:1229:10)

[--trace-promises] resolved promise #38
    at handleFdClose (node:internal/fs/promises:416:10)
    at readFile (node:internal/fs/promises:1229:10)

[--trace-promises] resolved promise #14
    at readFile (node:internal/fs/promises:1229:10)

[--trace-promises] resolved promise #19
[--trace-promises] promise #39 created promise #40
[--trace-promises] promise #38 created promise #41
[--trace-promises] resolved promise #35
[--trace-promises] resolved promise #36
[--trace-promises] created promise #42
    at readFileHandle (node:internal/fs/promises:543:15)

[--trace-promises] promise #42 created promise #43
    at readFileHandle (node:internal/fs/promises:542:30)

[--trace-promises] promise #43 created promise #44
    at readFileHandle (node:internal/fs/promises:542:30)

[--trace-promises] resolved promise #37
[--trace-promises] resolved promise #42
[--trace-promises] resolved promise #43
[--trace-promises] resolved promise #34
    at readFileHandle (node:internal/fs/promises:565:9)

[--trace-promises] resolved promise #44
[--trace-promises] created promise #45
    at close (node:internal/fs/promises:241:23)
    at node:internal/fs/promises:418:38

[--trace-promises] created promise #46
    at primordials.SafePromisePrototypeFinally (node:internal/per_context/primordials:472:3)
    at close (node:internal/fs/promises:240:29)
    at node:internal/fs/promises:418:38

[--trace-promises] created promise #47
    at SafePromise (node:internal/per_context/primordials:456:29)
    at node:internal/per_context/primordials:473:5
    at primordials.SafePromisePrototypeFinally (node:internal/per_context/primordials:472:3)
    at close (node:internal/fs/promises:240:29)
    at node:internal/fs/promises:418:38

[--trace-promises] promise #45 created promise #48
    at node:internal/per_context/primordials:473:31
    at SafePromise (node:internal/per_context/primordials:456:29)
    at node:internal/per_context/primordials:473:5
    at primordials.SafePromisePrototypeFinally (node:internal/per_context/primordials:472:3)
    at close (node:internal/fs/promises:240:29)
    at node:internal/fs/promises:418:38

[--trace-promises] created promise #49
    at SafePromise (node:internal/per_context/primordials:456:29)
    at node:internal/per_context/primordials:474:15
    at primordials.SafePromisePrototypeFinally (node:internal/per_context/primordials:472:3)
    at close (node:internal/fs/promises:240:29)
    at node:internal/fs/promises:418:38

[--trace-promises] created promise #50
    at SafePromise (node:internal/per_context/primordials:456:29)
    at node:internal/per_context/primordials:475:8
    at primordials.SafePromisePrototypeFinally (node:internal/per_context/primordials:472:3)
    at close (node:internal/fs/promises:240:29)
    at node:internal/fs/promises:418:38

[--trace-promises] promise #46 created promise #51
    at node:internal/fs/promises:418:17

[--trace-promises] resolved promise #39
[--trace-promises] promise #51 created promise #52
[--trace-promises] resolved promise #45
[--trace-promises] resolved promise #47
[--trace-promises] resolved promise #48
[--trace-promises] created promise #53
    at SafePromise (node:internal/per_context/primordials:456:29)

[--trace-promises] resolved promise #53
[--trace-promises] created promise #54
    at SafePromise (node:internal/per_context/primordials:456:29)

[--trace-promises] resolved promise #49
[--trace-promises] resolved promise #54
[--trace-promises] created promise #55
    at SafePromise (node:internal/per_context/primordials:456:29)

[--trace-promises] resolved promise #49
[--trace-promises] resolved promise #55
[--trace-promises] resolved promise #46
[--trace-promises] resolved promise #50
[--trace-promises] resolved promise #51
[--trace-promises] resolved promise #39
[--trace-promises] resolved promise #52
[--trace-promises] resolved promise #38
[--trace-promises] resolved promise #40
[--trace-promises] resolved promise #14
[--trace-promises] resolved promise #41
[--trace-promises] resolved promise #13
    at getSource (node:internal/modules/esm/load:72:42)

[--trace-promises] resolved promise #20
[--trace-promises] resolved promise #12
    at defaultLoad (node:internal/modules/esm/load:158:5)

[--trace-promises] resolved promise #21
[--trace-promises] resolved promise #11
    at load (node:internal/modules/esm/loader:411:5)

[--trace-promises] resolved promise #22
[--trace-promises] created promise #56
    at moduleStrategy (node:internal/modules/esm/translators:150:56)
    at callTranslator (node:internal/modules/esm/loader:285:14)
    at moduleProvider (node:internal/modules/esm/loader:291:30)

[--trace-promises] resolved promise #56
    at moduleStrategy (node:internal/modules/esm/translators:162:3)
    at callTranslator (node:internal/modules/esm/loader:285:14)
    at moduleProvider (node:internal/modules/esm/loader:291:30)

[--trace-promises] resolved promise #10
    at moduleProvider (node:internal/modules/esm/loader:291:30)

[--trace-promises] resolved promise #23
[--trace-promises] promise #56 created promise #57
[--trace-promises] resolved promise #10
[--trace-promises] resolved promise #57
[--trace-promises] created promise #58
    at primordials.SafePromiseAllReturnVoid (node:internal/per_context/primordials:541:3)
    at link (node:internal/modules/esm/module_job:91:15)

[--trace-promises] resolved promise #58
    at node:internal/per_context/primordials:543:32
    at primordials.SafePromiseAllReturnVoid (node:internal/per_context/primordials:541:3)
    at link (node:internal/modules/esm/module_job:91:15)

[--trace-promises] promise #58 created promise #59
    at link (node:internal/modules/esm/module_job:91:15)

[--trace-promises] resolved promise #25
[--trace-promises] created promise #60
    at primordials.SafePromiseAllReturnArrayLike (node:internal/per_context/primordials:515:3)
    at link (node:internal/modules/esm/module_job:94:14)

[--trace-promises] resolved promise #60
    at node:internal/per_context/primordials:520:23
    at primordials.SafePromiseAllReturnArrayLike (node:internal/per_context/primordials:515:3)
    at link (node:internal/modules/esm/module_job:94:14)

[--trace-promises] resolved promise #24
    at link (node:internal/modules/esm/module_job:94:14)

[--trace-promises] resolved promise #59
[--trace-promises] promise #60 created promise #61
[--trace-promises] resolved promise #24
[--trace-promises] resolved promise #61
[--trace-promises] resolved promise #26
[--trace-promises] created promise #62
    at primordials.SafePromiseAllReturnVoid (node:internal/per_context/primordials:541:3)
    at addJobsToDependencyGraph (node:internal/modules/esm/module_job:122:14)

[--trace-promises] resolved promise #62
    at node:internal/per_context/primordials:543:32
    at primordials.SafePromiseAllReturnVoid (node:internal/per_context/primordials:541:3)
    at addJobsToDependencyGraph (node:internal/modules/esm/module_job:122:14)

[--trace-promises] resolved promise #29
    at addJobsToDependencyGraph (node:internal/modules/esm/module_job:122:14)

[--trace-promises] resolved promise #30
[--trace-promises] promise #62 created promise #63
[--trace-promises] resolved promise #29
[--trace-promises] resolved promise #63
[--trace-promises] resolved promise #28
    at _instantiate (node:internal/modules/esm/module_job:192:5)

[--trace-promises] resolved promise #31
[--trace-promises] created promise #64
    at run (node:internal/modules/esm/module_job:218:25)

[--trace-promises] resolved promise #64
    at run (node:internal/modules/esm/module_job:218:25)

[--trace-promises] promise #64 created promise #65
    at run (node:internal/modules/esm/module_job:218:25)

[--trace-promises] resolved promise #32
[--trace-promises] resolved promise #27
    at run (node:internal/modules/esm/module_job:243:44)

[--trace-promises] resolved promise #65
[--trace-promises] resolved promise #1
    at import (node:internal/modules/esm/loader:330:19)

[--trace-promises] resolved promise #33
[--trace-promises] resolved promise #0
    at loadESM (node:internal/process/esm_loader:34:33)

[--trace-promises] resolved promise #6
[--trace-promises] resolved promise #7
    at handleMainPromise (node:internal/modules/run_main:122:13)

[--trace-promises] resolved promise #8
```
</details>

And when loading one extra module in the entry point it creates 125 promises in total - from my testing, every module loaded results in 59 more promises. And this is when the graph is completely synchronous (i.e. no http modules, no top-level await).

```js
// main.mjs
import { hello } from "./mod.mjs"

// mod.mjs
export const hello = 'world';
```

After discussion with @GeoffreyBooth we think some work should be put into this to reduce the overhead/noise. Either more work can be moved to C++ to restrict unnecessary async-await or we can carve out a synchronous path in the ESM loader to handle synchronous graphs.

Theoretically only one immediately settled promise has to be created by v8 for each synchronous module - even that one may not really have to be a promise - in the V8 API contract, as far as a synchronous graph is concerned, that promise is more of a poor-man's Maybe type rather than an actual async construct (if evaluation succeeds V8 immediately resolves it with undefined, otherwise immediately rejects). So the quest is to ideally reduce the overhead to just that one per module (even then is should be possible for a different V8 API to skip that one completely) for a synchronous graph.