Closed winterrdog closed 7 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.
checking git history before filing a PR for the win: 0a4daa62d6d7889e630428325e08dfe8e83caf5e
@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🫡
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.
Alright 👍
I've taken note 📝
Thanks for the clarification and insight 🤝🤝
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 to25
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:
intsort
function achieves optimal performance across a wide range of input sizes. Selection Sort's efficiency for small datasets ensures quick sorting without overhead, while Quick Sort's superior performance scales efficiently for larger datasets.@rofl0r , Lemme know what you think about it?