I have always heard that linear search is a naive approach and binary search is better than it in performance due to better asymptotic complexity. But I never understood why is it better than linear search when sorting is required before binary search?

Linear search is O(n) and binary search is O(log n). That seems to be the basis of saying that binary search is better. But binary search requires sorting which is O(n log n) for the best algorithms. So binary search shouldn't be actually faster as it requires sorting.

I am reading CLRS in which the author implies that in insertion sort instead of using the naive linear search approach it is better to use binary search for finding the place where item has to be inserted. In this case this seems to be justified as at each loop iteration there is a sorted list over which the binary search can be applied. But in the general case where there is no guarantee about the data set in which we need to search isn't using binary search actually worse than linear search due to sorting requirements?

Are there any practical considerations that I am overlooking which make binary search better than linear search? Or is binary search considered better than linear search without considering the computation time required for sorting?

because once you have a sorted list you don't need to re-sort it each time which means that if you have more than O(log n) searches sorting in advance will net you a gain win (O(n log n + k log n) vs O(k*n)

I think that the value of binary search over linear search is contextual. If you start with an enormous unordered data set and only plan to pluck a small number of items from it, then sorting and performing a binary search will be slow. If, however, you maintain an ordered list throughout the lifetime of your application and access it regularly, then binary search is a far better way to go.

Like many others have answered, binary search is indeed preferable because the sorting step can be done only once and the actual searching can then be done as many times as you like. However, for certain values of n (i.e. certain input sizes), binary search is always more performing than linear search (even for one single run).

The "tipping point" is computed by solving the asymptotical complexity equation:

n log n + log n = n

As you can see on Wolfram Alpha there is a numerical value for n that ensures that binary search and sorting is always faster than linear search alone. Of course the actual value of n that works in your case depends on many factors which may be difficult to estimate.

According to this interesting article by Mark Probst, which includes some nice in depth performance measurements on current processors:

If you need to search through a sorted array of integers and
performance is really, really important, use linear search if your
array is below around 64 elements in size, binary search if it’s
above.