mirror of
https://github.com/bevyengine/bevy
synced 2025-01-13 21:54:51 +00:00
365cf3114a
# Objective All delimiter symbols used by the path parser are ASCII, this means we can entirely ignore UTF8 handling. This may improve performance. ## Solution Instead of storing the path as an `&str` + the parser offset, and reading the path using `&self.path[self.offset..]`, we store the parser state in a `&[u8]`. This allows two optimizations: 1. Avoid UTF8 checking on `&self.path[self.offset..]` 2. Avoid any kind of bound checking, since the length of what is left to read is stored in the `&[u8]`'s reference metadata, and is assumed valid by the compiler. This is a major improvement when comparing to the previous parser. 1. `access_following` and `next_token` now inline in `PathParser::next` 2. Benchmarking show a 20% performance increase (#9364) Please note that while we ignore UTF-8 handling, **utf-8 is still supported**. This is because we only handle "at the edges" what happens exactly before and after a recognized `SYMBOL`. utf-8 is handled transparently beyond that. |
||
---|---|---|
.. | ||
enums | ||
impls | ||
path | ||
serde | ||
array.rs | ||
fields.rs | ||
from_reflect.rs | ||
lib.rs | ||
list.rs | ||
map.rs | ||
reflect.rs | ||
std_traits.rs | ||
struct_trait.rs | ||
tuple.rs | ||
tuple_struct.rs | ||
type_info.rs | ||
type_path.rs | ||
type_registry.rs | ||
type_uuid.rs | ||
type_uuid_impl.rs | ||
utility.rs |