IntegerLookup layer performance issue when inited with vocabulary
Hi, @jamm1985!
Could you please have a look at this [gist](https://colab.research.google.com/gist/sushreebarsa/fec0fc1cc1c00c82eced3bc83fc7d035/65610.ipynb) where I could reproduce this output ? Kindly confirm the results?
```
8.22 ms ± 363 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
509 µs ± 91.1 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
421 µs ± 7.34 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
``` 

Thank you! Hi @sushreebarsa!

This is the same code snippet from the bug report. My timings are slightly different as it depends on system load, but I confirm that `tf.keras.layers.IntegerLookup(vocabulary=vocab.tolist())` is an order of magnitude slower. @sushreebarsa from your colab gist:

```
print(tf.__version__)
# 2.15.0
```

this bug also affects version 2.15. Hi @jamm1985 ,

I have checked with tf-nightly and there seems no performance issue. Please check the attached [gist](https://colab.sandbox.google.com/gist/SuryanarayanaY/b615a3abfd92852654817695db057ecb/65610_tf-nightly.ipynb) and confirm. @SuryanarayanaY 

I confirm that this bug does not affect tf-nightly. Hi @jamm1985 ,

Thanks for confirmation. Since the issue resolved in nightly can we mark this as closed? Please feel free to close the issue. Thanks! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. Hi @SuryanarayanaY :

I hope this bug can be fixed in versions 2.14 and 1.15 as these are the most heavily used versions in production right now.
### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

No

### Source

binary

### TensorFlow version

2.14.0

### Custom code

No

### OS platform and distribution

Ubuntu 20.04

### Mobile device

_No response_

### Python version

3.9

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

I ran into a performance issue when calling an IntegerLookup layer initialized with a Python list vocabulary. Please see code snippet.

Note that passing a numpy array as a vocabulary does not cause performance issues, but hangs during serialization since only the list in [code](https://github.com/keras-team/keras/blob/68f9af408a1734704746f7e6fa9cfede0d6879d8/keras/layers/preprocessing/index_lookup.py#L839) is checked.

### Standalone code to reproduce the issue

```shell
import tensorflow as tf
import numpy as np

vocab = np.arange(0,10_000,1)
data = np.array([[10,20,30,40], [50,60,70,20_000]])

layer_1 = tf.keras.layers.IntegerLookup(vocabulary=vocab.tolist())
%timeit layer_1(data)
# 6.21 ms ± 349 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) # <- that is issue

layer_2 = tf.keras.layers.IntegerLookup(vocabulary=vocab) # pass as numpy
timeit layer_2(data)
# 285 µs ± 6.04 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)

layer_3 = tf.keras.layers.IntegerLookup()
layer_3.adapt(vocab.tolist())
%timeit layer_3(data)
# 286 µs ± 1.31 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)

```
```


### Relevant log output

_No response_