For some preprocessing task, I would like to use an expl3 property list. Since the number of items in that list would be in the thousands - index entries for a textbook - I was wondering how time-efficient this might be. So, I did some testing:
\documentclass{article}
\usepackage{expl3,xparse, fp}
% timing adapted from http://tex.stackexchange.com/questions/9087
\def\startTimer{\pdfresettimer}
\def\stopTimer{%
\FPdiv\result{\the\pdfelapsedtime}{65536}
\FPround\result{\result}{3}\par
Time (seconds): \result \par}
\ExplSyntaxOn
\prop_new:N \sg_user_mapping
\cs_generate_variant:Nn \prop_gput:Nnn { Nxx }
\int_new:N \i_target
\int_new:N \i_counter
\NewDocumentCommand{\dostuff}{m} {
Adding\ #1\ keys\ to\ user\ mapping\par
%\prop_gclear:N \sg_user_mapping
\startTimer
\int_add:Nn \i_target {#1}
\int_zero:N \i_counter % Hopefully obvious!
\int_while_do:nn { \i_counter < \i_target }
{
\edef\wurst{\int_to_arabic:n \i_counter}
\prop_gput:Nxx \sg_user_mapping {hans\wurst} {0}
\int_incr:N \i_counter
}
\stopTimer\par
}
\ExplSyntaxOff
\begin{document}
\ttfamily
\dostuff{10}
\bigskip
\dostuff{100}
\bigskip
\dostuff{1000}
\bigskip
\dostuff{10000}
\end{document}
Here is what I get:
So, that is a clear case of O^2; I'm guessing that the entire list gets scanned before a new entry is inserted.
I'm wondering if it would be viable to use some behind-the-scenes trickery in order to exploit pdftex's built-in hashtables. For example, for each key-value pair,
sanitize the key by stripping out any characters that can't be part of a command name:
#foo%^bar!- baz?becomesfoobarbazcreate a property list (as currently implemented) under the name
\pl_userland_foobarbazstore
#foo%^bar!- baz?=>whatever valuein that list.
I actually tried that, and the code, while obviously slower for small numbers of keys, does scale with O^1 as expected, and it reaches parity with the straight, simple property list at about 1000 keys. I hesitate to post that code here, since I'm only beginning with expl3, and the pros could probably do a better job of it; it was only an experiment.
Of course my suggestion brings up the question how many such keys and property list instances pdfTeX will be able to accommodate before starting to throw the toys out of the pram? Alternatively, it may be possible to implement a proper hash table in TeX itself; but I'm not up to snuff in that regard.

expl3has an FPU, so you don't also needfphere, you can use\fp_eval:n. – Joseph Wright Dec 04 '16 at 21:23