public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* Performance improvements for std::sort
@ 2017-10-07 16:11 Furkan Usta
  2017-10-07 17:08 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Furkan Usta @ 2017-10-07 16:11 UTC (permalink / raw)
  To: libstdc++

Hi, I was checking sort implementation in other languages/implementations
and found out a simple optimization that is performed by libc++ and BSD
qsort.

I've implemented the same idea on libstdc++ and observed some improvements.

All the test cases include 10M elements, and results are in ms.

Increasing
  Modified:  65
  Original: 236
Decreasing
  Modified:  55
  Original: 173
Random
  Modified: 1039
  Original: 1054
Pipe Organ
  Modified: 26
  Original: 81

Main point of the optimization is that, if during partition no swaps have
been made, then the list might be almost sorted, or even already sorted. In
that case, perform an incomplete insertion sort (allowing only 8-insertion
runs) and reduce the bounds of the list accordingly.


I would like to contribute that optimization to libstdc++, but I have 2
questions:
1) I've found the idea from an another project, would it be a problem
license-wise (though they both have permissive licenses)?

2) Can I sign copyright assignment form online or do I have to actually
print some forms, sign and send them?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Performance improvements for std::sort
  2017-10-07 16:11 Performance improvements for std::sort Furkan Usta
@ 2017-10-07 17:08 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2017-10-07 17:08 UTC (permalink / raw)
  To: Furkan Usta; +Cc: libstdc++

On 7 October 2017 at 17:11, Furkan Usta wrote:
> Hi, I was checking sort implementation in other languages/implementations
> and found out a simple optimization that is performed by libc++ and BSD
> qsort.
>
> I've implemented the same idea on libstdc++ and observed some improvements.
>
> All the test cases include 10M elements, and results are in ms.
>
> Increasing
>   Modified:  65
>   Original: 236
> Decreasing
>   Modified:  55
>   Original: 173
> Random
>   Modified: 1039
>   Original: 1054
> Pipe Organ
>   Modified: 26
>   Original: 81
>
> Main point of the optimization is that, if during partition no swaps have
> been made, then the list might be almost sorted, or even already sorted. In
> that case, perform an incomplete insertion sort (allowing only 8-insertion
> runs) and reduce the bounds of the list accordingly.
>
>
> I would like to contribute that optimization to libstdc++, but I have 2
> questions:
> 1) I've found the idea from an another project, would it be a problem
> license-wise (though they both have permissive licenses)?

Contributing to GCC is a bit more complicated. To assign copyright to
the FSF you need to be the copyright holder, and if you copy someone
else's code then you aren't the copyright holder.

> 2) Can I sign copyright assignment form online or do I have to actually
> print some forms, sign and send them?

You send a form to the FSF who send you back paperwork to print and
sign. You can return a scanned copy.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-07 17:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-07 16:11 Performance improvements for std::sort Furkan Usta
2017-10-07 17:08 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).