Joseph Wright writes:
> On 14/04/2011 09:44, Will Robertson wrote:
> > * These should probably be consistent.
> > * I think returning a quark is dangerous in case of sloppy package authors.
>
> If we want consistency between \seq_... and \prop_..., then that is fine
> but we also need to worry about performance.

right let's worry about performance (you know I do that quite often :-)

> lists, as they are used a lot in siunitx. With the short test file
>
>   \documentclass{article}
>   \usepackage{expl3}
>   \begin{document}
>   \ExplSyntaxOn
>   \prop_new:N \test
>   \tl_new:N \testa
>   \prop_put:Nnn \test { a } { b }
>   \pdfresettimer
>   \prg_replicate:nn { 10000 }
>     {
>       \prop_get:NnN \test { a } \testa
>       \quark_if_no_value:NTF \test { } { }
>     }
>   \showthe\pdfelapsedtime
>
>   \pdfresettimer
>   \prg_replicate:nn { 10000 }
>     {
>       \prop_if_in:NnTF \test { a }
>         {
>           \prop_get:NnN \test { a } \testa
>         }
>         { }
>     }
>   \showthe\pdfelapsedtime
>   \end{document}

well try this one as well which is what I was thinking of (kind of):

\cs_new:Npn \prop_get:NnNF #1#2#3#4 {
\prop_get:NnN #1 {#2} #3
\quark_if_no_value:NF
{
\cs_set_eq:NN #3 \c_undefined
#4
}
}

\pdfresettimer
\prg_replicate:nn { 50000 }
{
\prop_get:NnNF \test { a } \testa
{ }
}
\showthe\pdfelapsedtime

> I find that the quark-based approach is about twice as fast as using
> \prop_if_in:Nn. Granted, this is somewhat artificial, but I do
> essentially this a lot inside siunitx and do not really want to loose
> speed if I can avoid it.

basically it tells us that \prop_if_in:Nn is fairly inefficient and that in
turn is due to it using \quark_if_no_value:nTF I guess. Saving the result and
then checking it is much much faster. Perhaps that implementation should
change.

frank