-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Let Match be a struct. It's immutable and one is created per route match. Benchmark is updated as follows: Before: router 541.14k ( 1.85µs) (± 3.28%) 2.02kB/op fastest After: router 594.45k ( 1.68µs) (± 1.06%) 1.83kB/op fastest * Use StaticArray for segments to avoid memory allocation The benchmark times are updated as follows: Before: router 590.63k ( 1.69µs) (± 1.06%) 1.83kB/op fastest After: router 720.56k ( 1.39µs) (± 1.16%) 1.33kB/op fastest * No need to use Char::Reader in PathReader Given that we are only looking for the ascii characters '/' and '%', and UTF-8 guarantees that these will always come as individual bytes in the beginning of a character, we can simply traverse the string by bytes. This avoids decoding UTF-8 and gives a small performance boost. Benchmark times are updated as follows: Before: router 720.56k ( 1.39µs) (± 1.16%) 1.33kB/op fastest After: router 767.78k ( 1.30µs) (± 3.48%) 1.33kB/op fastest * Avoid variable shadowing * Avoid using `to_unsafe` * Don't use `uninitialized` This should be safer, and it seems performance isn't affected. * Make ameba happy
- Loading branch information
Showing
5 changed files
with
71 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters