Now that we have function return type inference (CLJS-1997), we can see that functions like namespace return strings. Additionally, we can easily make it so that expressions involving str are inferred as returning strings. With those two in place, with a mild extension to CLJS-2314, we can eliminate unnecessary string coercions in str macro expansions where arguments are inferred to be strings.
This leads to performance gains which are akin to checked-if elimination (but perhaps even greater):
Now that we have function return type inference (CLJS-1997), we can see that functions like
namespace
return strings. Additionally, we can easily make it so that expressions involvingstr
are inferred as returning strings. With those two in place, with a mild extension to CLJS-2314, we can eliminate unnecessary string coercions instr
macro expansions where arguments are inferred to be strings.This leads to performance gains which are akin to checked-if elimination (but perhaps even greater):
Yields these speedups under
:advanced
V8: 3.2
SpiderMonkey: 1.3
JavaScriptCore: 4.2
Nashorn: 2.5
ChakraCore: 3.2
GraalVM: 1.3
This could be great for UIs that are heavy in string-concatenation, as well as for the self-hosted compiler.
Details: