rofl0r / proxychains-ng

proxychains ng (new generation) - a preloader which hooks calls to sockets in dynamically linked programs and redirects it through one or more socks/http proxies. continuation of the unmaintained proxychains project. the sf.net page is currently not updated, use releases from github release page instead.
http://sourceforge.net/projects/proxychains-ng/files
GNU General Public License v2.0
9.74k stars 1.07k forks source link

integrated quick-sort into `intsort` function #559

Closed winterrdog closed 5 months ago

winterrdog commented 5 months ago

Description

This pull request introduces a hybrid sorting approach within the intsort function, combining both Selection Sort and Quick Sort algorithms. For small datasets (less than or equal to 25 elements), Selection Sort is utilized for its simplicity and efficiency. Conversely, for larger datasets, Quick Sort is employed to leverage its superior performance characteristics in case it's ever needed in future code commits.

Reason:

@rofl0r , Lemme know what you think about it?

rofl0r commented 5 months ago

this is total overkill, there are only 4 ints to be sorted - that's why i replaced the quicksort that was used in the original PR with a tiny intsort.

rofl0r commented 5 months ago

checking git history before filing a PR for the win: 0a4daa62d6d7889e630428325e08dfe8e83caf5e

winterrdog commented 5 months ago

@rofl0r, that's alright!

I just thought it'd be needed in the future for bigger arrays, but I get it. If it's just 4 elements, it'd b total overkill 🤝

Dropping the commit🫡

rofl0r commented 5 months ago

even if it was 50 ints, this is absolutely not performance sensitive. it's called only once on startup. the whole code of proxychains-ng is dominated by i/o syscalls, that's why it's built without optimization by default. it really doesn't matter whether proxychains spends 500 cycles per connect() call or 2000. both only take nanoseconds, vs milliseconds or even seconds spent on the wire.

winterrdog commented 5 months ago

Alright 👍

I've taken note 📝

Thanks for the clarification and insight 🤝🤝