Skip to content

Conversation

@ascholerChemeketa
Copy link
Contributor

This attempts to removes duplicative parses of the source tree to speed up processing.

On test book (decent size, lots of xincludes) each parse of the xml takes ~1-4 seconds depending on how I have the filesystem mounted. Removing 3 parses speeds up the overhead to start the build proper by about 10 seconds.

Notes/testing suggestions:

  • First commit has utility class and second sets up timing of project parsing. Run with log level debug to see timing checkpoints.
  • Third commit removes the logic that tries to determine RS output dir. That code parses the runestone target even if that is not the active target of the current command. It looks like the logic is no longer used anyway. If it really is needed, should probably move or be gated so it is only done for RS builds.
  • Fourth commit adds timing for the target build.
  • Fifth caches calls to source_element() for a given target so the parsing in it is not repeated.
  • Sixth: instead of doing a separate ETree.parse() to validate the source, just try to load it via source_element (since that will be needed again anyway).
  • Reuse the existing parsed source_element to run schema validation.

After testing the 1st/2nd/4th commits can be dropped.

@ascholerChemeketa
Copy link
Contributor Author

Force push with black corrections

@oscarlevin
Copy link
Member

I really like this. I'm not seeing a huge speedup, but every little bit helps and philosophically it is a huge improvement.

Because I like the timing stuff and don't want to lose this example, I will close this for historical purposes and complete the PR at #1100

@oscarlevin oscarlevin closed this Dec 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants