I am writing some Objective-C code which will be publicly available. The code mainly consists of well known algorithms which would benefit from optimization. I am planning on writing most of the code in C to reduce the overhead on creating objects and garbage collection. Is this considered bad practice?
No it's not. This is done quite frequently actually.
Generally one does this when one needs time critical code to run quicker (everything else equal, calling a C function is quicker than an Objective-C method).
However, it may also be nicer in some other cases to write C functions instead.
Remember though that Objective-C is a superset of C. Everything C can do, Objective-C can do, and it should not be considered bad to do anything C can do. There may be cases where doing some things is discouraged, but anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With