Unisay / purescript-lua

Purescript compiler back-end for Lua
GNU General Public License v3.0
56 stars 2 forks source link

Program transformation to uncurry functions for which all applications are fully saturated. #24

Open Unisay opened 7 months ago

Unisay commented 7 months ago
local add = function(x) 
  return function(y) 
    return x + y 
  end 
end

is two times slower than

local add = function(x, y) 
  return x + y 
end

The idea is to rewrite former to latter but only for functions that are always fully-applied, e.g. a partial application

add(i)

never happens in the program being compiled;

The applications need to be rewritten too:

add(x)(y) ===> add(x,y)