aboutsummaryrefslogtreecommitdiff
path: root/src/lux/optimizer.clj
blob: e50d2aae94758f8f4796323e212cb0e49c2da782 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(ns lux.optimizer
  (:require [lux.analyser :as &analyser]))

;; [List of pending optimizations]
;; Global functions: direct currying or direct invocation when function is known at compile-time
;; Improving function calls: add extra arities (apply2, apply3, ..., apply16)
;; Recursion: tail-call optimization
;; Pattern-matching: decision-trees to avoid unnecessary tests
;; Less classes generated per function: Fold nested function classes into one.
;; Mutability for performance: do escape analysis to know when data-structures can be mutated in-place without anybody noticing.
;; Avoid (un)boxing: Analyser movement of primitive values to/from functions to known when (un)boxing can be avoided.
;; Pre-compute constant expressions: Find function calls for which all arguments are known at compile-time and pre-calculate everything prior to compilation.
;; Convert pattern-matching on booleans into regular if-then-else structures
;; Local var aliasing.
;; Global var aliasing.

;; [Exports]
(defn optimize [eval!]
  (&analyser/analyse eval!))