Hacker News new | ask | show | jobs
by ursusmaritimus 911 days ago
I don't think that it's silly - it's just over-engineered :)

What the author describes is a general data structure called a "number tree", which is a general mapping from integers to arbitrary objects, represented as a tree of PDF objects. It is used in the standard at many places; in some cases, the keys are not consecutive.

The advantage over a plain dictionary or array is that the whole structure need not fit it memory at once. It's questionable if this is ever needed, but in early days of the PDF standard machines were much smaller and the authors decided to plan for documents with millions of pages processed by small machines. This style of thinking permeates the whole standard: see for example the page tree.

Still, it's unnecessarily complex for all but a tiny fraction (possibly zero) of uses. I would really appreciate if it were possible to use dictionaries instead of number trees whenever the tree is small.