[M3devel] STL algorithms? sort/unique?

Dragiša Durić dragisha at m3w.org
Thu Oct 4 20:30:40 CEST 2012



On Oct 4, 2012, at 3:59 AM, Jay K wrote:

> vector<int> is small, contains 3 pointers.
> And one level of indirection for accessing the data.
> printf("%d\n", vi[0]); has one level of indirection and will be inlined in any decent compiler.

Probably because preprocessor is in this equation?

> 
> 
> 
> IntSeq.T is one pointer, and probably contains also approximately 3 pointers.
> The Modula-3 has an extra level of indirection.

And what is vector<int> if not pointer to some collection of pointers? 

IntSeq is generic instantiation. Calls can be inlined by decent compiler. There lies probable reason for generics in Modula-3. So efficiency junkies can have their way :).

In my opinion, Moore's law combined with lives of my applications usually being longer than Moore's interval does all the extra speed magic I need.

> 
> 
> Not every function should be "virtual".
> "object.method" is useful syntax for statically typed "object".
> s.get(0) probably involves like 3 pointer derefences.

As opossed to C++'s two dereferences?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20121004/2fff5c4a/attachment-0002.html>


More information about the M3devel mailing list