Optimization Principles
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1k
- Forks
- 28
- Avg merge
- 21h 46m
- Merged PRs (30d)
- 2
Description
Most engines follow similar design patterns and those patterns generalize to principles we use to optimize Math. We DO NOT optimize for details in specific engines or engine versions. If am optimization is a hack for V8 or JSC then it has no place.
- 32-bit integers can be stored in a pointer in most engines. This is an easy optimization to reach for and allows for allocation to skip the heap. Using these kinds of integers can put our code on a fast path.
- Corollary to 32-bit integers, bit operations are supported on 32-bit integers and are optimized at the byte code level.
- JS is a dynamic type language so all engines must check types. Engines usually optimize for stable types so we want to make sure we aren't casting types (for example integer to float, or holey array to packed array).
- We also want to optimize for consistent types in call sites (IC optimizations for V8).
- LLVM code beats JS byte code so we want to rely on built-ins like
Math.x.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, entry points, tests, or concrete optimization target. Start by reviewing the existing TypeScript math helpers against the listed engine-agnostic principles; the work is done only once a specific scope and validation criteria are agreed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100