Skip to content
Advertisement

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 situation. I also tried both gcc

What HW resource is mostly used when one does memcpy()?

This feels like a very newbie question, but I suddenly find myself clueless. I’m trying to profile a c application that does a lot of memory copies, and there is an option for me to reduce that number (requires some re-design). I’m trying to realize if it’s worth it, but I have no idea what resource it will affect, or

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 seconds but my goal its to

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 couple possibilities

Advertisement