PERF: custom ops for RangeIndex.[all|any|__contains__]
State: closed

- [x] xref #26565
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Follow-up to #26565. Make ``RangeIndex._data`` be created in fewer cases.

Performance examples (but the larger gain is from memory savings by not creating the ``_data`` array):

```python
>>>  rng = pd.RangeIndex(-5_000_000, 0, 6)
>>> %timeit rng.all()
789 µs ± 5.24 µs per loop  # master
216 ns ± 0.957 ns per loop  # this PR
>>> %timeit rng.any()
763 µs ± 6.08 µs per loop  # master
124 ns ± 9.15 ns per loop  # this PR
>>> %timeit (-2 in rng)
380 ns ± 1.85 ns per loop  # master
689 ns ± 44.7 ns per loop  # this PR, slightly slower
```


Labels:
name: Performance
description: Memory or execution speed performance
name: Index
description: Related to the Index class or subclasses

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26617?src=pr&el=h1) Report
> Merging [#26617](https://codecov.io/gh/pandas-dev/pandas/pull/26617?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/437efa6e974e506c7cc5f142d5186bf6a7f5ce13?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `92%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/26617/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/26617?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #26617      +/-   ##
==========================================
- Coverage   91.85%   91.85%   -0.01%     
==========================================
  Files         174      174              
  Lines       50722    50741      +19     
==========================================
+ Hits        46593    46606      +13     
- Misses       4129     4135       +6
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.39% <92%> (-0.01%)` | :arrow_down: |
| #single | `41.79% <72%> (-0.08%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26617?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tbW9uLnB5) | `98.48% <100%> (+0.06%)` | :arrow_up: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.71% <100%> (-0.01%)` | :arrow_down: |
| [pandas/core/indexes/range.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9yYW5nZS5weQ==) | `97.6% <87.5%> (-0.46%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97% <0%> (-0.12%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26617?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26617?src=pr&el=footer). Last update [437efa6...cfd68e5](https://codecov.io/gh/pandas-dev/pandas/pull/26617?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26617?src=pr&el=h1) Report
> Merging [#26617](https://codecov.io/gh/pandas-dev/pandas/pull/26617?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/891a419a5155e6b42c0696a81cf853b6f3febbf7?src=pr&el=desc) will **decrease** coverage by `1.46%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/26617/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/26617?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #26617      +/-   ##
==========================================
- Coverage   91.87%   90.41%   -1.47%     
==========================================
  Files         174      174              
  Lines       50661    50668       +7     
==========================================
- Hits        46547    45809     -738     
- Misses       4114     4859     +745
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.41% <100%> (ø)` | :arrow_up: |
| #single | `?` | |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26617?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.71% <100%> (-0.01%)` | :arrow_down: |
| [pandas/core/indexes/range.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9yYW5nZS5weQ==) | `98.52% <100%> (+0.04%)` | :arrow_up: |
| [pandas/io/feather\_format.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2ZlYXRoZXJfZm9ybWF0LnB5) | `21.05% <0%> (-68.43%)` | :arrow_down: |
| [pandas/core/computation/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vcHl0YWJsZXMucHk=) | `62.5% <0%> (-27.75%)` | :arrow_down: |
| [pandas/io/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3B5dGFibGVzLnB5) | `63.82% <0%> (-26.48%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |
| [pandas/core/computation/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vY29tbW9uLnB5) | `84.21% <0%> (-5.27%)` | :arrow_down: |
| [pandas/core/computation/expr.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vZXhwci5weQ==) | `94.5% <0%> (-3.03%)` | :arrow_down: |
| [pandas/io/clipboard/clipboards.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2NsaXBib2FyZC9jbGlwYm9hcmRzLnB5) | `31.88% <0%> (-2.9%)` | :arrow_down: |
| [pandas/io/formats/printing.py](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvcHJpbnRpbmcucHk=) | `84.49% <0%> (-1.07%)` | :arrow_down: |
| ... and [4 more](https://codecov.io/gh/pandas-dev/pandas/pull/26617/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26617?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26617?src=pr&el=footer). Last update [891a419...4aea46d](https://codecov.io/gh/pandas-dev/pandas/pull/26617?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Comments addressed. The typing issue must wait until #26581 is merged for mypy to see _range.
can you add the issue number onto the one you already have in Performance section; merge master as well.  ping on green.