Skip to content

Optimization Principles #49

Description

@krispya

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions