Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor parsing in bevy_reflect path module #9048

Merged
merged 4 commits into from
Aug 5, 2023

Conversation

nicopap
Copy link
Contributor

@nicopap nicopap commented Jul 5, 2023

Objective

Solution

  • Create the parse.rs module, move all parsing code to this module
  • The parsing errors also now keep track of the whole parsed string, and are much more fine-grained

Detailed changes

  • Move PathParser to parse.rs submodule
  • Rename token_to_access to access_following (yep, goes from 132 lines to 16)
  • Move parsing tests into the parse.rs file

@nicopap nicopap added C-Code-Quality A section of code that is hard to understand or change S-Blocked This cannot move forward until something else changes A-Reflection Runtime information about types labels Jul 5, 2023
@nicopap nicopap added this to the 0.12 milestone Jul 18, 2023
@nicopap nicopap force-pushed the better-path-parsing branch from a5fa5ea to 5617e80 Compare July 31, 2023 07:34
@nicopap nicopap removed the S-Blocked This cannot move forward until something else changes label Jul 31, 2023
@nicopap nicopap force-pushed the better-path-parsing branch from 5617e80 to 7779156 Compare July 31, 2023 07:40
@nicopap nicopap marked this pull request as ready for review July 31, 2023 07:41
@MrGVSV MrGVSV self-requested a review July 31, 2023 08:47
@nicopap
Copy link
Contributor Author

nicopap commented Jul 31, 2023

I found out that parsing in "ascii mode" is much better in terms of performance. And there is no reason to not do it (apart from maintainability). What I will do is remove the comment wrt alternative impl and open a performance PR with all the unsafe.

@nicopap
Copy link
Contributor Author

nicopap commented Jul 31, 2023

This is the optimized version I came up with:

https://gist.github.com/nicopap/9a1c04bf549914036ea5cc5d6e23269b

@MrGVSV
Copy link
Member

MrGVSV commented Aug 1, 2023

This is the optimized version I came up with:

https://gist.github.com/nicopap/9a1c04bf549914036ea5cc5d6e23269b

Are you planning to add this optimized version in this PR or opening a followup PR?

@nicopap
Copy link
Contributor Author

nicopap commented Aug 1, 2023

Are you planning to add this optimized version in this PR or opening a followup PR?

follow up PR

Copy link
Member

@MrGVSV MrGVSV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just two nits and then some other non-blocking comments.

crates/bevy_reflect/src/path/parse.rs Outdated Show resolved Hide resolved
use super::*;
use crate::path::ParsedPath;

#[test]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Not blocking, but while we're here could we add some tests for the other kinds of errors?

crates/bevy_reflect/src/path/parse.rs Outdated Show resolved Hide resolved
crates/bevy_reflect/src/path/mod.rs Outdated Show resolved Hide resolved
crates/bevy_reflect/src/path/parse.rs Show resolved Hide resolved
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Aug 5, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Aug 5, 2023
Merged via the queue into bevyengine:main with commit 10797d4 Aug 5, 2023
@nicopap nicopap deleted the better-path-parsing branch August 30, 2023 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Reflection Runtime information about types C-Code-Quality A section of code that is hard to understand or change S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
Status: Open
Development

Successfully merging this pull request may close these issues.

5 participants