To `ref` or not to `ref` on embedded?

2022-09-25 Thread Stefan_Salewski
> Usually the best performance can be found by getting in the habit of using > var in proc arguments for arrays or struct. Using var openArray[T] with T > being non-ref objects generally gives good performance. Ref objects can be > useful if you can't use var due to code constraints.

To `ref` or not to `ref` on embedded?

2022-09-24 Thread elcritch
I've used ref objects on embedded and it can be fine and very convenient even. Prefer a acyclic with ARC. Partly though it depends on how much RAM you have. Here's some rules of thumb I've found: * <16kB of free ram use very sparingly * the allocator means you'll only be able to

To `ref` or not to `ref` on embedded?

2022-09-24 Thread demotomohiro
I wrote about differences of 'ref object' and plain 'object' before:

To `ref` or not to `ref` on embedded?

2022-09-24 Thread arnetheduck
+1 - the simple advice is to never use `ref object` unless semantics demand it - then the caller can decide if they want a `ref Type` or not and type it out

To `ref` or not to `ref` on embedded?

2022-09-24 Thread auxym
Most people will avoid refs (and dynamic heap usage in general in embedded) because of the associated runtime cost, the difficulty in predicting memory usage on these constrained systems, and the risk of heap fragmentation. That said, use them sparingly if you have to, and you know the limits

To `ref` or not to `ref` on embedded?

2022-09-24 Thread BarrOff25
Hello I want to do some project on an arduino board. Writing some code I started thinking about whether using `ref` objects or not makes sense for embedded targets? What are the pros and cons of each option?