
David Abrahams wrote:
Yuval Ronen
writes: The default version of front always takes at least two instantiations (begin<...> and deref<...>). If you can do front in one instantiation and you want the optimization, you'd better specialize it. If this single instantiation you save is important (which sounds to me
David Abrahams wrote: like too small a thing to mess with, but if you claim otherwise, I'll take your word for it),
It's at least a 50% savings, and quite possibly more than 50%.
It's at most 50%, not at least. Remember that I compare specializing 'front' to using the default 'front' + specializing 'begin'. Any optimization you put in 'front' you can also put in 'begin', so you save exactly one instantiation saved, which is at most 50%. But again, if you say that it's important, then I'll accept it.
then wouldn't you want to specialize 'back' as well as 'front', if possible? You might be able save an instantiation there as well...
You might want to do that, yes... "if possible" being key words here.
Moreover, if this single instantiation saving is important, should it be specialized for *all* sequences, including those already present in mpl?
I don't have an opinion on it, and I don't see where you're going with that question.
Where I was going (or was trying to go - we'll see if I'll actually get there) is to show that there is a contradiction between two things. The first is the claim that a single instantiation is worth saving. The second is Forward Sequence requiring 'front' and not 'back'. If we're that much into saving, then it should require back for the same reason as it requires front. And also all sequences should take advantage of this, and actually specialize front and back to save this instantiation. The other option is to declare that an extra single instantiation s not that bad, not require front/back, and leave all possible optimizations to begin/end. The default front/back will work fine. I hope I could explain myself better this time.