Marvee Amasi
Marvee Amasi
DIIDevHeads IoT Integration Server
Created by Marvee Amasi on 7/4/2024 in #middleware-and-os
Optimizing a bubble sort implementation in C for an x86-64 architecture
Without optimizations:
./sort 1000000 2.54s user 0.01s system 99% cpu 2.552 total
./sort 1000000 2.54s user 0.01s system 99% cpu 2.552 total
-O2:
./sort 1000000 1.25s user 0.00s system 99% cpu 1.253 total
./sort 1000000 1.25s user 0.00s system 99% cpu 1.253 total
-O3:
./sort 1000000 1.78s user 0.01s system 99% cpu 1.790 total
./sort 1000000 1.78s user 0.01s system 99% cpu 1.790 total
The relevant part of my bubble sort function is included below:
13 replies