Skip to content

code generator #16

Description

@leafo

add to-lua compiler for type checkers for improved performance. Because performance is highest priority, optimize out error messages since they currently generate a lot of work when going down invalid paths.

Possible interface:

types.string\compile! -> plain old lua function that performs the transformation

Exploration

It probably makes sense to manually write out optimized version of code for different composite types to understand how things should be structured. We probably have to support fallback for when types can't be compiled, they can be turne d

-- types.string
local value, state = ...
if type(value) == "string" then
  return true, state
end
return nil
-- types.string + types.nil
local value, state = ...
if type(value) == "string" then
  return true, state
end

if value == nil then
  return true
end

return nil

Other ideas

  • Have JIT compiling for type checkers that are hot

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions