|
|
|
|
|
by tomjen3
5231 days ago
|
|
Well that depends on the type of pointer -- if you only need the reference till the end of the function, (or when you deconstruct a class) you can get a much more performant implementation. As for speed, with benchmarking every thing is in the details and while GC can be made to run fast the actual speed depends on the access patterns, the cache and when memory is used (and for how long). In addition in C++ you can put quite a lot of things on the stack (that is actually how you make a smart-pointer) which is always going to be much, much faster than anything on the heap. |
|