Speed up ../characters endpoint for plays with many characters#377
Open
cmil wants to merge 1 commit into
Open
Conversation
Refactor dutil:characters-info to precompute lookup maps in single passes over the TEI document instead of re-scanning per character: - index particDesc person/personGrp nodes by @xml:id - walk //tei:sp once to build speech-act and word-count maps - invert segments into a scene-count map - index metrics nodes by @id For "Die letzten Tage der Menschheit" (925 characters) this brings the request from >2min (gateway timeout) down to seconds. Preserves legacy counting semantics: numOfSpeechActs still counts only sp elements whose @who references a single speaker; numOfWords still distributes shared speeches to each referenced speaker. Closes #249
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor
dutil:characters-infoto precompute lookup maps in single passes over the TEI document instead of re-scanning per character:particDescperson/personGrpnodes by@xml:id//tei:sponce to build speech-act and word-count maps@idFor "Die letzten Tage der Menschheit" (925 characters) this brings the request from >2min down to seconds.
Preserves legacy counting semantics:
numOfSpeechActsstill counts only sp elements whose@whoreferences a single speaker;numOfWordsstill distributes shared speeches to each referenced speaker.Closes #249