lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2014/1/23 Gaspard Bucher <gaspard@teti.ch>:

> I am working on a fast xml library (using RapidXML) and want to implement a
> simple search algorithm to find the first node with a given tag.
>
> From my own extensive use of such 'find' functions, the objects to find are
> usually near the surface so I want to avoid depth-first search.

Two thoughts:

1. Do you mean "first" according to some definition of precedence or "any"?
2. In either case, the overhead in creating a Lua table by tag (values being
nodes or arrays of nodes) may be compensated by Lua's fast hashtable
searching.