{{ break }} is actually improving time by ~50%
But the actual lifesaver was index. I don’t even have to use where.
In my scenario, with a slightly different data structure (map[%itemName:%description]), that translates to:
{{ with resources.GetRemote $url $options }}
{{ $t := debug.Timer "index" }}
{{ $data := . | transform.Unmarshal }}
{{ $description := index $data $.Title }}
{{ $description }}
{{ $t.Stop }}
{{ end }}
Pretty eloquent logs:
"range" average 65.3ms
"range + break" average 35.3ms -> ~2 times faster
"index" average 0.18ms -> ~362 times faster O_O
Thanks @jmooring you are the best as always.
That’s funny that my original data is already “the key for each map would be the title”