Hey guys
Hey guys,
Some days ago I started a project of implementing data structures just for ARC-enabled platforms, my initial idea was to not mix the new memory management with the old one, all objects added are handled by reference counting and I don't rely on Free calls. The first data structure implemented was a Queue, more (priority queues, hash maps) will come soon, the code is available at https://github.com/horaciojcfilho/Kelloggi/blob/master/GoSeaHorse.Kelloggi.pas#L132-L283. This implementation has some advanges over the RTL's, such as a constructor for set the initial capacity, Contains function, defensive coding around enumerator usage, and slightly smaller binary. It was tested on Android 4.1 and 4.4 devices and worked :D Without Free calls, the world is more happy :D Once I am new at Delphi programming, any sort of help is apreciated.
Thanks a lot :D
Some days ago I started a project of implementing data structures just for ARC-enabled platforms, my initial idea was to not mix the new memory management with the old one, all objects added are handled by reference counting and I don't rely on Free calls. The first data structure implemented was a Queue, more (priority queues, hash maps) will come soon, the code is available at https://github.com/horaciojcfilho/Kelloggi/blob/master/GoSeaHorse.Kelloggi.pas#L132-L283. This implementation has some advanges over the RTL's, such as a constructor for set the initial capacity, Contains function, defensive coding around enumerator usage, and slightly smaller binary. It was tested on Android 4.1 and 4.4 devices and worked :D Without Free calls, the world is more happy :D Once I am new at Delphi programming, any sort of help is apreciated.
Thanks a lot :D
That's cool. A very neat piece of code! Have never seen how FIFO queues are implemented with arrays. The tail wrapping is a great idea. And TInt32.NextPowerOfTwo implementation is very interesting too.
ReplyDeleteVitali Burkov I think the RTL queue is not implemented any different.
ReplyDeleteVitali Burkov Many thanks :D Next power of two implementation can be found at http://graphics.stanford.edu/~seander/bithacks.html along many other bit hacks that you might get interested.
ReplyDeleteStefan Glienke It is true, both implementations use circular queue idea :D
ReplyDelete