Optimize string expression concatenation

Description

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):

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:

Environment

None

Attachments

5

Activity

Show:

Mike Fikes November 9, 2018 at 1:08 AM

CLJS-2865-5.patch rebaselines while also accommodating the changes in that are currently on master.

This revision of the patch passes CI, Canary, and shows no slowdown when compiling the Coal Mine corpus.

Mike Fikes November 7, 2018 at 1:40 PM

CLJS-2865-4.patch no longer applies

Mike Fikes October 26, 2018 at 12:52 PM

CLJS-2865-4.patch rebaselines

Mike Fikes October 26, 2018 at 12:41 PM

Patch no longer applies.

Completed

Details

Assignee

Reporter

Approval

Patch

Priority

Created August 19, 2018 at 12:56 PM
Updated November 23, 2018 at 6:34 PM
Resolved November 23, 2018 at 6:34 PM