ARROW-10772: [Rust] Speed up take by writing to buffer
ARROW-10772: [Rust] Speed up take by writing to buffer

This speeds up `take` a bit more by creating / writing to a buffer directly instead of creating an intermediate Vec. Quite some kernels could benefit from a similar change.

@jorgecarleitao I don't know whether this is the correct/easiest way of doing this currently?
I also think it is related to your PR/discussion about using `Vec` .

Local benchmark results:
```
Benchmarking take i32 512: Collecting 100 samples in estimated 5.0027 s (5.8M it
take i32 512            time:   [782.83 ns 835.58 ns 901.10 ns]
                        change: [-38.602% -34.097% -29.230%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 14 outliers among 100 measurements (14.00%)
  2 (2.00%) high mild
  12 (12.00%) high severe

Benchmarking take i32 1024: Collecting 100 samples in estimated 5.0024 s (3.1M i
take i32 1024           time:   [1.4874 us 1.5975 us 1.7365 us]
                        change: [-39.280% -32.409% -24.891%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  8 (8.00%) high severe

Benchmarking take i32 nulls 512: Collecting 100 samples in estimated 5.0003 s (5
take i32 nulls 512      time:   [887.77 ns 942.04 ns 1.0056 us]
                        change: [-37.017% -32.331% -27.416%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 15 outliers among 100 measurements (15.00%)
  5 (5.00%) high mild
  10 (10.00%) high severe

Benchmarking take i32 nulls 1024: Collecting 100 samples in estimated 5.0005 s (
take i32 nulls 1024     time:   [1.4689 us 1.5630 us 1.6789 us]
                        change: [-35.852% -30.746% -25.307%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  1 (1.00%) high mild
  8 (8.00%) high severe
```

Closes #8803 from Dandandan/allocate

Authored-by: Heres, Daniel <61924dac3230581b78b62e9e0cd0f8203281db27@gmail.com>
Signed-off-by: Andy Grove <f68909d51919859739a1c5d24450a2cc1026e93b@gmail.com>

icexelloss/arrow,cpcloud/arrow,wesm/arrow,laurentgo/arrow,wesm/arrow,apache/arrow,cpcloud/arrow,icexelloss/arrow,cpcloud/arrow,apache/arrow,icexelloss/arrow,wesm/arrow,icexelloss/arrow,icexelloss/arrow,laurentgo/arrow,icexelloss/arrow,laurentgo/arrow,apache/arrow,apache/arrow,icexelloss/arrow,wesm/arrow,icexelloss/arrow,laurentgo/arrow,wesm/arrow,wesm/arrow,kou/arrow,apache/arrow,kou/arrow,wesm/arrow,cpcloud/arrow,icexelloss/arrow,cpcloud/arrow,kou/arrow,wesm/arrow,wesm/arrow,kou/arrow,cpcloud/arrow,laurentgo/arrow,cpcloud/arrow,kou/arrow,cpcloud/arrow,icexelloss/arrow,apache/arrow,laurentgo/arrow,wesm/arrow,cpcloud/arrow,laurentgo/arrow,icexelloss/arrow,laurentgo/arrow,icexelloss/arrow,cpcloud/arrow,laurentgo/arrow,laurentgo/arrow,wesm/arrow,apache/arrow,wesm/arrow,kou/arrow,kou/arrow,cpcloud/arrow,cpcloud/arrow,apache/arrow,laurentgo/arrow,apache/arrow,kou/arrow,laurentgo/arrow,icexelloss/arrow,apache/arrow,cpcloud/arrow,apache/arrow,kou/arrow,kou/arrow,icexelloss/arrow,kou/arrow,wesm/arrow,laurentgo/arrow,apache/arrow,kou/arrow,kou/arrow,apache/arrow,cpcloud/arrow,laurentgo/arrow,wesm/arrow,laurentgo/arrow,kou/arrow,apache/arrow