dlang-community/SDLang-D

Consider downgrading DOM ranges from random-access to optimize/simplify internal structures.

Abscissa opened this issue · 0 comments

Random access in the DOM seems seldom-needed. In the rare case it is, the user could simply use std.array.array() to get an array of whatever is needed.

Ditching random access for tags and attributes (values are fine, they're just a plain array) would allow much of the internal lookup stuctures to be eliminated. That, in turn, would allow add/remove/rename to be greatly simplified and greatly improve speed (currently O(n), could be (O(1)).

popFront/popBack would be slightly more complicated (but only slightly), as they would need to skip over non-matching elements. Seems a reasonable tradeoff.