- Created `openspec-ff-change` skill for fast-forward artifact creation. - Introduced `openspec-new-change` skill for structured change creation. - Developed `openspec-onboard` skill for guided onboarding through OpenSpec workflow. - Added `openspec-sync-specs` skill for syncing delta specs to main specs. - Implemented `openspec-verify-change` skill for verifying implementation against change artifacts. - Updated `.gitignore` to exclude OpenSpec generated files. - Added `skills-lock.json` to manage skill dependencies.
29 lines
654 B
Markdown
29 lines
654 B
Markdown
---
|
||
title: Promise.all() for Independent Operations
|
||
impact: CRITICAL
|
||
impactDescription: 2-10× improvement
|
||
tags: async, parallelization, promises, waterfalls
|
||
---
|
||
|
||
## Promise.all() for Independent Operations
|
||
|
||
When async operations have no interdependencies, execute them concurrently using `Promise.all()`.
|
||
|
||
**Incorrect (sequential execution, 3 round trips):**
|
||
|
||
```typescript
|
||
const user = await fetchUser()
|
||
const posts = await fetchPosts()
|
||
const comments = await fetchComments()
|
||
```
|
||
|
||
**Correct (parallel execution, 1 round trip):**
|
||
|
||
```typescript
|
||
const [user, posts, comments] = await Promise.all([
|
||
fetchUser(),
|
||
fetchPosts(),
|
||
fetchComments()
|
||
])
|
||
```
|