Performance Profiling
- Measure first. A profiler shows where time actually goes: optimising before measuring polishes code that was never the problem.
- Hot paths. The flame graph’s widest frames are the hot path; a small win there beats a big win anywhere else.
- Micro versus macro. Users feel macro costs: network waits, layout thrash, long tasks: long before any clever loop trick matters.
Common JavaScript Security Risks
- XSS. Cross-site scripting: XSS: is user text reaching innerHTML unescaped, letting attackers run script as your page.
- Injection. Any string you concatenate into a command, query or HTML is an injection door; parameterised APIs close it.
- Secrets in clients. Anything shipped to the browser is public: API keys belong on a server the client asks politely.
Reliable Production Patterns
- Graceful degradation. Production code plans for failure: a fallback answer, a retry with backoff, an honest error the user can act on.
- Idempotency. An idempotent operation lands the same result when repeated: the property that makes retries safe.
- Observability. Logging the inputs and decisions on real failures turns tomorrow’s mystery bug into a five-minute read.
Before and after this level
- Before: Level 14: Testing & Code Quality: Unit and Integration Testing, Static Analysis and Linting, Designing Testable JavaScript.
- Next: Level 16: JavaScript Mastery: Advanced Runtime Behaviour, Architecture and Language Trade-Offs, Reading and Improving Complex JavaScript.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does JavaScript Level 15: Performance & Security cover?
Performance Profiling, Common JavaScript Security Risks, Reliable Production Patterns: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 14: Testing & Code Quality, which covers Unit and Integration Testing, Static Analysis and Linting, Designing Testable JavaScript.