Description
Is your feature request related to a problem? Please describe.
Currently, in order to fetch a couple attributes:
- JS has to create a bunch of
Attribute
classes - Collect them into a array
- Iterate over this array
- Read attribute name into a string
- Check if the attribute name is correct
- Read the desired attribute value into a string and store it
- Repeat from 4 until all fields are collected
This is inefficient, as we only really want to iterate over the XML and do 5
, 6
and 7
Describe the solution you'd like
An API such as Tag.extractAttributes()
which takes a list of keys and returns the key: value
pairs in an object. This would be able to skip Attribute
construction, the double iteration, and even some string conversions with extra optimization.
Describe alternatives you've considered
My existing solution works, but could be quicker.
Additional context
23% of profiled time in my application is spent in get attributes()
, which is a waste, alongside 13% of time spent in get value()
for Text
during this loop which could be reduced with smarter key comparisons.