Skip to content

Tag: optimization

Why is linear search so much faster than binary search?

Consider the following code to find a peak in an array. If I compile with -O3 and use the linear search solution (the peak function) it takes: If I use the binary search solution which should be much faster (the peak_rec function), it takes: I tried turning off optimization but this didn’t change the si…

Optimizing C for loops [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about programming within the scope defined in the help center. Closed 6 years ago. Improve this question I have been trying to optimize my program so far I got down to 8 se…

Unzipping bz2 file

I have the following command to open a tbz file: The compressed file is about 15 GB and when it is expanded it is about 500GB or so. This operation on an ec2-4x-large operation takes roughly 1h40m. Is there a way to optimize this operation? What would be the fastest way to do the above operation? Answer A cou…