4 ms·
This interesting, i am especially impressed by the debugging stuff... however I contest the assertion of good performance. If you are using the Objective-C runt
by jheriko 14y ago
This interesting, i am especially impressed by the debugging stuff... however I contest the assertion of good performance. If you are using the Objective-C runtime then, in my world, you are dog slow. Sorry.
Anything that stops doing 10,000 nothings from compiling out is dirt to me... too easy to screw your performance by accident with Objective-C messaging and objects. (don't get me wrong, I enjoy their enormous power, I'd just like to only pay for it if I actually need something that dynamic - which is almost never)
- jrajav 14y agoIf you like Objective-C but not Apple's runtime, you should check out ObjFW: https://webkeks.org/objfw/ https://webkeks.org/objfw/
- lgg 14y agoTo be pedantic, ObjFW is an alternative framework, not an alternative runtime. They do include a runtime for architectures that do not have a native ObjC runtime, but that runtime is API compatible with Apple's. Since they use the same compilers (clang and gcc) they have the same inlining limitations and the compiler will generate calls into the runtime in the exact same places.
- Midar 14y agoBut the runtime has a faster dispatch than Apple's ;). Actually, I don't get all this "Messaging is slow". In the ObjFW runtime, it's just 12 instructions for x86_64. That's barely noticable. I even used ObjC in an HPC application and compared it to the C version, just for fun. There was no measurable difference in performance. What's more important in the average application is that the foundation classes are fast. For example, C#'s and Cocoa's dictionaries are really slow (but I don't know why). While C# and Cocoa both need 1.2 sec to insert 1 Mio objects into a dictionary and retrieve them, ObjFW only needs 0.3.
- fyolnish 14y agoMust be nice in the world of unfounded assertions. Tranquil achieves good performance (when compared to other dynamic languages like ruby or python) by using tagged pointers for numbers & bypassing messages for arithmetic operators if both operands are tagged; batching allocations for objects frequently used in the fastpath, and other tricks. If you compare it with writing straight C ..obviously it's slow. But then so is anything else.
- jheriko 14y agoits perfectly well founded and measurable. my issue with objective-c and its runtime is the message passing implementation and the reliance on it - it is incredibly powerful, but the cost is phenomenal in the contexts i work with - and a common optimisation i find myself doing is making C++ style calls out of c functions with a 'this' as the first parameter. there is no real need for this cost if the compiler could have more information about use and respected the "don't pay for what you don't need"
- jheriko 14y ago(it is good you avoid it for operators etc. - so you must be aware of the issue and how it can be avoided with a little common sense and work)
- stcredzero 14y ago> if I actually need something that dynamic - which is almost never The classic case of someone criticizing a screwdriver for not being a chisel. (And then saying, "Oh, look, see how well my chisel chisels?")
- jheriko 14y agoi'd like to use objective-c as both screwdriver and chisel. there is nothing wrong with this imo - i can see how to fix the problems myself for instance. it would make a very good chisel with some work, without compromising its screwdriver capabilities.
- chc 14y agoYour criticism reads a bit like "This kitchen knife says it cuts amazingly fast and clean, but as a lumberjack, I have to say I find it's horrible at cutting."
- jheriko 14y agothis is a very good analogy and precisely what i am saying. :)