-
Notifications
You must be signed in to change notification settings - Fork 199
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
Add an API to get the filename without parsing spans #384
Comments
You can get that info without parsing spans if you look in |
Let's document it then 😄 |
While useful that doesn't fit my usecase (unless I'm doing something wrong).
but
|
That's right, it's not very simple indeed. |
I see that the info struct has a filename char*. Can we use it if we're not enabling spans? |
The problem with spans is that they make the entire tree take quite a bit more memory; that's the reason why they are disabled by default. How much additional CPU usage do you see ? This will most likely be due to additional allocation (the information that goes into spans is not very hard to collect internally) If you really can't use spans for your purpose, and since querying the tree directly will be pretty hairy, we could add a call to the API, something like How often do you need to query the filename for a node ? |
I query it once per node (and then cache) since I want users to be able to filter by filenames as well. |
I just looked at this again, and thought about how this would be implemented; it occurred to me that adding the XSLT function starts-with would let you do what you want; i.e., you could then say
If you need to do that for every node though, no matter what we do (including the |
I can cache the function call very easily so it won't be called the next time. I think that aug_source_file is missing from the API regardless of my use-case. It'd be useful to add it for others as well. |
Have a look at the PR I just posted and let me know if that would work for you - it introduces a new |
Is it possible to get the filename without parsing spans?
If it is, can we expose an API that does that?
The text was updated successfully, but these errors were encountered: