This is an archive of the discontinued LLVM Phabricator instance.

Expand a lambda that is used only once.
ClosedPublic

Authored by ruiu on Feb 17 2018, 3:53 PM.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

ruiu created this revision.Feb 17 2018, 3:53 PM
sbc100 accepted this revision.Feb 19 2018, 10:47 AM

I was considering doing that myself, and managed to persuade myself it was more readable with the lamda since it makes the loop itself self-documenting and really easy to read. But I can see that single use lambda are probably not a good pattern and that a commit is probably just as good. BTW, do you now if there is any runtime different between these two (given a decent compiler)?

This revision is now accepted and ready to land.Feb 19 2018, 10:47 AM
ruiu added a comment.Feb 19 2018, 2:35 PM

I didn't actually try to see the assembly output for this file, but decent compilers are smart enough to figure out that the lambda can be inlined, so I don't think this change doesn't improve performance.

This revision was automatically updated to reflect the committed changes.