Heap Allocation free Parsing: structs
03/23/2019
I have been working on a library RapideFix to parse fix messages. One of the challenges is to parse a message into a struct with the least amount of allocations possible. That means to allocate only for the references (if any) that are part of the struct's fields.
For the sake of this post, I will use a very simple struct with 2 integer properties and the parser method will set values to them. However, the code should be dynamic, so the user can replace the struct to any other custom one.
Starting Point
So, let's start with a sample code, which is incorrect after all, but it demonstrates what I want to achieve (if it worked correctly).So what I want to do is that given a string with two integers separated by commas "20,19,"
, and the parser should set the integer values on a struct, Point
: