Closed mkeskells closed 6 years ago
Could you please assign this to me?
Hi @rorygraves I have no idea on how to optimize this piece of code:
Some((1 to m.groupCount).toList map m.group)
Could you please give me some suggestions?
some ideas from @mkeskells
Some((1 to m.groupCount).toList map m.group)
Could be changed to:
var result = List.empty(...)
var count = m.groupCount
while (count > 0) {
result = m.group(count) :: result
count -= 1
}
or
@tailrec a def for above code could be better
or
Some((1 to m.groupCount).map(m.group)(breakOut))
@ackratos can you share the benchmark & branch
@mkeskells i pasted the branch above https://github.com/scala/scala/pull/6048 haven't pushed micro benchmark.
resolved at https://github.com/scala/scala/pull/6048
Great stuff
On 23 Sep 2017, at 10:30, cong notifications@github.com wrote:
resolved at scala#6048
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
regex code looks able to be improved
just be code inspection, looks to allocating temp data
benchmark & improve