3 ms·
> the language aims to have no performance overhead versus C and C++. Could someone expand on this for me? What is the performance overhead typically associate
by okamiueru 12y ago
> the language aims to have no performance overhead versus C and C++.
Could someone expand on this for me? What is the performance overhead typically associated with C/C++?
- cgh 12y agoIt means Loci will perform similarly to C and C++, not that C and C++ have some particular overhead that Loci doesn't.
- zem 12y agoi think they mean that loci should have the same performance as c or c++.
- heinrich5991 12y agoE.g. null-terminated strings without length perform badly in some operations.
- lucozade 12y agoAn example would be dynamic dispatch of virtual functions. In C++ virtual functions are implemented as vtables attached to each object. As such you need to retrieve the object (possibly from the heap), there's a function pointer indirection, there may be trampolines if you're using multiple inheritance. That sort of thing. The author has a nice piece in the documentation regarding how dynamic dispatch is implemented in loci in order to support structural typing. He explains the design choice, how it differs from C++ (a vtable at each interface reference call site) and gives some qualitative estimates as to how the performance would differ. It's worth the read. C doesn't have dynamic dispatch built in to the language. If you want it, you'd have to code it by hand.