JavaScript binary search
I would just like to hi-light a few points of difference in the two and how I think they are reflected in what you are seeing.


When making a comparison between arr[target] and ele, if they are not the same then you do not need to include target within the bounds of the next iteration (hence the +/- 1). This can reduce the number of comparisons though the effect is more significant on smaller datasets.
When following the above point, it becomes sufficient terminate as "not found" when beginning &gt; end rather then check that you are looking at the beginning or end value. Also your approach may provide a false negative when looking for "B" in the following situation.

    target
    |
    v
... A B
    ^ ^
    | |
    | end
    beginning


In this situation, because target === beginning and arr[target] !== B, it returns -1.
The googled code uses parseInt, I'm not sure how this affects correctness but I suspect this has an adverse effect on the performance.


I think what you are seeing in the scalability is because the googled code does fewer comparisons but the parseInt makes the comparisons more expensive. The reduced number of comparisons is more significant for small data sets, but for larger data sets cost of the comparison becomes more significant.

I would suggest some experimentation/investigation to see if this is accurate.