drym-org / qi

An embeddable flow-oriented language.
58 stars 12 forks source link

Arity inference compiler pass #158

Open countvajhula opened 6 months ago

countvajhula commented 6 months ago

Qi in many cases does not distinguish variadic functions from fixed-arity functions. We may be able to infer the appropriate arity in practice, and apply these functions to a specific number of arguments instead of an arbitrary number, as this would be faster.

This could be done by building a table of known arities of built-in APIs that would be available to the compiler, and there may be other, generally-applicable, ways as well.

See also: Compiler Optimizations Optimizations Next Optimizations