# std.mem: add vectorized indexOfScalarPos and indexOfSentinel · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/cd766513febecd79fc62a0f46ee18867fabbbf7d)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: cd766513febecd79fc62a0f46ee18867fabbbf7d

Requested commit: cd766513febecd79fc62a0f46ee18867fabbbf7d

Commit: cd766513febecd79fc62a0f46ee18867fabbbf7d

Tree: 48be459f4fa7bb743867f22c683098cbc4353596

Author: Marc Tiehuis

Committer: Marc Tiehuis

## Message

```
std.mem: add vectorized indexOfScalarPos and indexOfSentinel

These are an order of magnitude quicker than the previous
implementations:

A relative comparison of each, measuring scanning a 1G file.

    Reading 1G (1.0000000009313226GiB)

             std.mem.sliceTo: 281.232ms
          vectorized.sliceTo: 24.769ms
                      strlen: 24.291ms

           std.indexOfScalar: 229.016ms
    vectorized.indexOfScalar: 24.685ms
                      memchr: 24.958ms

```

## Parents

- [873c695c41dffd89ba7ef1b3ed6662e429bfa00d](https://git.cafe/gitcafe/zig/commit/873c695c41dffd89ba7ef1b3ed6662e429bfa00d?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/cd766513febecd79fc62a0f46ee18867fabbbf7d?format=markdown)
