Author Topic: Proposal: Associative String Arrays  (Read 2423 times)


  • Hero Member
  • *****
  • Posts: 1468
Re: Proposal: Associative String Arrays
« Reply #15 on: May 13, 2023, 12:03:11 pm »
Like when I have a string, it is faster to keep the string in a pointer variable and call fpc_AnsiStr_Decr_Ref on it to free it, rather than relying on the automated freeing of fpc
The treatment of managed types in the Generics.Collection Containers is really bad. Back when managed records where new, I've created a bunch of stack local datastructures, like lists, sets, etc. for local use, which would be copied when an assignment is used. Then I've found out the hard way, that Generics.Collection shuffles the data around internally using only assignments, which resulted in horrible performance as the whole Lists have been newly allocated, copied and the old one freed.

Also the Initialization is done with FillChar with 0's, which may work for strings, arrays and COM interfaces, but when you have a record that contains a CRC, even for empty data (all 0's) the CRC will not be 0, meaning that this results in an undefined state for the object.

Long story short, Generics.Collections and managed types don't go that well together, which is why I've wrote my own datastructures, which use raw pointers to data internally (and copy data around using Move), and only use the actual types on the interfacing functions, so all internal computations with these types skips all management operations


TinyPortal © 2005-2018