Re: svn commit: r300731 - head/sys/netinet

2016-05-28 Thread Hans Petter Selasky
On 05/28/16 07:09, Pieter de Goeje wrote: Hi, Replacing the bubble sort with insertion sort gives an 80% reduction in runtime on average (with randomized keys) for small partitions. If the keys are pre-sorted, insertion sort runs in linear time, and even if the keys are reversed, insertion sort

Re: svn commit: r300731 - head/sys/netinet

2016-05-27 Thread Pieter de Goeje
Hi, Replacing the bubble sort with insertion sort gives an 80% reduction in runtime on average (with randomized keys) for small partitions. If the keys are pre-sorted, insertion sort runs in linear time, and even if the keys are reversed, insertion sort is faster than bubble sort, although n

Re: svn commit: r300731 - head/sys/netinet

2016-05-26 Thread Hans Petter Selasky
On 05/26/16 14:10, Ed Schouten wrote: Hi Hans, 2016-05-26 13:10 GMT+02:00 Hans Petter Selasky : Use optimised complexity safe sorting routine instead of the kernel's "qsort()". Cool! Thanks for working on this! The custom sorting routine takes advantage of that the sorting key is on

Re: svn commit: r300731 - head/sys/netinet

2016-05-26 Thread Ed Schouten
Hi Hans, 2016-05-26 13:10 GMT+02:00 Hans Petter Selasky : > Use optimised complexity safe sorting routine instead of the kernel's > "qsort()". Cool! Thanks for working on this! > The custom sorting routine takes advantage of that the sorting key is > only 64 bits. Based on set and cleare

svn commit: r300731 - head/sys/netinet

2016-05-26 Thread Hans Petter Selasky
Author: hselasky Date: Thu May 26 11:10:31 2016 New Revision: 300731 URL: https://svnweb.freebsd.org/changeset/base/300731 Log: Use optimised complexity safe sorting routine instead of the kernel's "qsort()". The kernel's "qsort()" routine can in worst case spend O(N*N) amount of compar