Dataset scan time is much slower than using native arrow
MEMBER
Hi ! In your code you only iterate on the Arrow buffers - you don't actually load the data as python objects. For a fair comparison, you can modify your code using:
```diff
-     for _ in range(0, len(table), bsz):
-         _ = {k:table[k][_ : _ + bsz] for k in cols}
+     for _ in range(0, len(table), bsz):
+         _ = {k:table[k][_ : _ + bsz].to_pylist() for k in cols}
```

I re-ran your code and got a speed ratio of 1.00x and 1.02x
2023-01-27T12:15:20Z
https://github.com/huggingface/datasets/issues/5475#issuecomment-1406418823
https://api.github.com/repos/huggingface/datasets/issues/5475
IC_kwDODunzps5T1D-H
https://api.github.com/repos/huggingface/datasets/issues/comments/1406418823/reactions
2023-01-27T12:15:51Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1406418823
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
CONTRIBUTOR
Ah I see, datasets is implicitly making this conversion. Thanks for pointing that out!

If it's not too much, I would also suggest updating some of your docs with the same `.to_pylist()` conversion in the code snippet that follows [here](https://huggingface.co/course/chapter5/4?fw=pt#:~:text=let%E2%80%99s%20run%20a%20little%20speed%20test%20by%20iterating%20over%20all%20the%20elements%20in%20the%20PubMed%20Abstracts%20dataset%3A).
2023-01-27T15:40:33Z
https://github.com/huggingface/datasets/issues/5475#issuecomment-1406672946
https://api.github.com/repos/huggingface/datasets/issues/5475
IC_kwDODunzps5T2CAy
https://api.github.com/repos/huggingface/datasets/issues/comments/1406672946/reactions
2023-01-27T15:40:33Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1406672946
https://avatars.githubusercontent.com/u/121845112?v=4
https://api.github.com/users/jonny-cyberhaven/events{/privacy}
https://api.github.com/users/jonny-cyberhaven/followers
https://api.github.com/users/jonny-cyberhaven/following{/other_user}
https://api.github.com/users/jonny-cyberhaven/gists{/gist_id}
https://github.com/jonny-cyberhaven
jonny-cyberhaven
U_kgDOB0M1eA
https://api.github.com/users/jonny-cyberhaven/orgs
https://api.github.com/users/jonny-cyberhaven/received_events
https://api.github.com/users/jonny-cyberhaven/repos
https://api.github.com/users/jonny-cyberhaven/starred{/owner}{/repo}
https://api.github.com/users/jonny-cyberhaven/subscriptions
User
https://api.github.com/users/jonny-cyberhaven
public
MEMBER
This code snippet shows `datasets` code that reads the Arrow data as python objects already, there is no need to add to_pylist. Or were you thinking about something else ?
2023-01-29T13:08:25Z
https://github.com/huggingface/datasets/issues/5475#issuecomment-1407659323
https://api.github.com/repos/huggingface/datasets/issues/5475
IC_kwDODunzps5T5y07
https://api.github.com/repos/huggingface/datasets/issues/comments/1407659323/reactions
2023-01-29T13:08:25Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1407659323
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
### Describe the bug

I'm basically running the same scanning experiment from the tutorials https://huggingface.co/course/chapter5/4?fw=pt except now I'm comparing to a native pyarrow version.

I'm finding that the native pyarrow approach is much faster (2 orders of magnitude). Is there something I'm missing that explains this phenomenon?

### Steps to reproduce the bug

https://colab.research.google.com/drive/11EtHDaGAf1DKCpvYnAPJUW-LFfAcDzHY?usp=sharing

### Expected behavior

I expect scan times to be on par with using pyarrow directly.

### Environment info

standard colab environment