Wouldn't this decrease again for large enough n, and even go negative after n=2^(w * 2)?
O(n+max(0,log(w/log n)))