[lld] r287042 - Use one task per iteration in parallel_for_loop.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 15 14:24:44 PST 2016
Can you try to run your benchmark again without --build-id? For me, this
patch slows down the linker by about 30% with --threads and without
--build-id.
On Tue, Nov 15, 2016 at 2:13 PM, Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: rafael
> Date: Tue Nov 15 16:13:16 2016
> New Revision: 287042
>
> URL: http://llvm.org/viewvc/llvm-project?rev=287042&view=rev
> Log:
> Use one task per iteration in parallel_for_loop.
>
> This seems far more natural. A user can create larger chunks if the
> overhead is too large.
>
> With this linking xul with "--threads --build-id=sha1 goes from
> 13.938177535 to 11.035953538 seconds on linux.
>
> Modified:
> lld/trunk/include/lld/Core/Parallel.h
>
> Modified: lld/trunk/include/lld/Core/Parallel.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/
> Core/Parallel.h?rev=287042&r1=287041&r2=287042&view=diff
> ============================================================
> ==================
> --- lld/trunk/include/lld/Core/Parallel.h (original)
> +++ lld/trunk/include/lld/Core/Parallel.h Tue Nov 15 16:13:16 2016
> @@ -284,12 +284,8 @@ void parallel_for_each(Iterator begin, I
> template <class Iterator, class Func>
> void parallel_for_each(Iterator begin, Iterator end, Func func) {
> TaskGroup tg;
> - ptrdiff_t taskSize = 1024;
> - while (taskSize <= std::distance(begin, end)) {
> - tg.spawn([=, &func] { std::for_each(begin, begin + taskSize, func);
> });
> - begin += taskSize;
> - }
> - std::for_each(begin, end, func);
> + for (; begin != end; ++begin)
> + tg.spawn([=, &func] { func(*begin); });
> }
> #endif
> } // end namespace lld
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161115/37281a5a/attachment.html>
More information about the llvm-commits
mailing list