lang: interpolate, funcs: Add a concat function for faster interpolation

This adds a concat function which can be used directly by string
interpolation to avoid having to constantly unify the plus operator
which is much slower at this time.

The new monomorphisms changes caused type unification of a notable
example to go from ~25s to ~5m30s which was obviously not bearable. With
this fix, things are now down to ~6s.

This is an important optimization, but it's also a good reminder that
type unification of polymorphic functions needs to be improved in
general too.
This commit is contained in:
James Shubin
2024-01-02 13:52:52 -05:00
parent d8db320722
commit a07dc0a511
4 changed files with 76 additions and 40 deletions

View File

@@ -44,6 +44,11 @@ const (
// CoreDir is the directory prefix where core mcl code is embedded.
CoreDir = "core/"
// ConcatFuncName is the name the concat function is registered as. It
// is listed here because it needs a well-known name that can be used by
// the string interpolation code.
ConcatFuncName = "concat"
)
// registeredFuncs is a global map of all possible funcs which can be used. You