Open
Description
We're heavily using string concentration via std.format
and I realized that it dramatically hurts the performance. We had to switch using the old way '' + ''
and had a huge performance boost. Here is an example:
["%s and %s" % ['test', 'test1'] for x in std.range(0, 1000)]
The script above is compiled in ~5000ms whereas the following one only takes around 50ms:
local test = 'test';
local test1 = 'test1';
[test + 'and' + test1 for x in std.range(0, 1000)]
I see that std.format
is implemented in Jsonnet but I believe it might be best to implement it as a native function as the logic is complex and it affects the performance dramatically.