xml - What is the absolutely cheapest way to select a child node in Nokogiri? -


I know that there are several ways to choose the first child element in Nokogiri, but which is the cheapest? I am unable to use node # kids, which looks very expensive. Say that there are 10000 hair nodes, and I do not want to touch 9999 others ...

node # The child is the fastest way to get the first child element.

However, if you are looking for nodes then there is no first (like, 99th), then there is no fast way to choose that node compared to calling # children and index.

You are right in saying that it is expensive to make nodesets for all children if you only want to get it already.

A limiting factor is that libxml2 (Nokogiri built-in XML library) stores the children of a node in the form of a linked list so you can select the desired hair node in the list (o ( N) will need to be crossed.

Rubbish objects for all other children would be possible to write the method to return to the nodeset or not only any one of the initial ways to open a feature request, or send an email to the Norokigiri mailing list Will be for you.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -