2018-01-08 21:30 GMT+01:00 Graeme Geldenhuys <mailingli...@geldenhuys.co.uk> :
> Speaking of Generics and Benchmarks. Has anybody done some benchmarks on > FPC's Generics vs "old-school" TList and TObjectList. Recently I did a very > simple test with Delphi XE3 using TList<Integer> and a stock TList. Adding > 50,000 and 200,000 integer values to each list, and timing the creation of > the list and population of the list. Then I also timed the destruction of > the list. I was horified to find out how much slower Delphi's Generics were > compared to TList and TObjectList. Destruction was 250x slower in many > cases. Creation and population of the list was 5x-10x slower. > > Lets hope FPC fares better. If nobody has done such tests, I can do it > tomorrow at work with the same Delphi test code I created. > It depends on use case and on library design. For example in the FPC case, generic TList<T> has better performance for larger lists (the capacity uses golden ratio) than regular TList (for Integers). The performance difference in daily usage is rather minor (if any). We have available detailed tests for generic and non generics hash maps thanks to Benito van der Zander (FPC has so many different maps! :) ): http://www.benibela.de/fpc-map-benchmark_en.html The results for rtl-generics should be better soon. I am working on new version of rtl-generics library, so all should works faster (better hashing function + optimizations for managed types - especially improved for incoming smart pointers/objects). -- Best regards, Maciej Izak
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal