Sortedlist uses single array. That is a scaling risk when you get into the 100k range.Yes. Should be heap allocated. The range can be even earlier depending on stack. Use a pointer type.
Sortedlist uses single array. That is a scaling risk when you get into the 100k range.Yes. Should be heap allocated. The range can be even earlier depending on stack. Use a pointer type.
(but again at the cost of speed)
Nice...Thank you.
Sortedlist uses single array. That is a scaling risk when you get into the 100k range.Yes of course.
It has a big issue: I assume for speed there is an over-use of {$H-} which not everybody likes, because it limits its applicability.
@Thaddy, could you clarify your point:I believe what he meant was: shortstrings are stack allocated, has much simpler structure and requires no manager, therefore it has speed advantage over ansistrings and other string types that doesn't have the 255 8-bit character limitation. This might be a good show in benchmark, but in reality, people might require more than 255 characters. The silent truncation behavior of most (or all?) of its related function doesn't help for sure.It has a big issue: I assume for speed there is an over-use of {$H-} which not everybody likes, because it limits its applicability.
@Thaddy, could you clarify your point:See Leledumbo's answer who beat me to it ;D.
The library should be transparent.
Your library does not rely on visual code.
E.g: I do not usually use the Lazarus ide but Geany.
You won't find any Lazarus macro's in any FPC library code.
That's also the reason I misinterpreted it at first glance.
Collection of generic algorithms and data structures entirely written in/for FPC and Lazarus. Started as a self-education project, it now seems quite comfortable and fast. In order to use it (FPC 3.1.1 and higher and Lazarus 1.9.0 and higher):
Also the types in Generics.Collections support records without any operator overload.Just curious.
One advantage of the FGL ones: they are small, so they're more suitable for embedded projects where memory size might be an issue.
And for those that are interested: here (http://www.benibela.de/fpc-map-benchmark_en.html) we have a performance comparison of various FPC containers (no, not by me).
Shouldn't all this effort be redirected to evolve official Generics implementation?
For example, I still use TCollection and TCollectionItem for visual components because they work well and have built-in design-time editors.
One of reasons may be that CodeTools still does not fully support generics, i.e. when you hit Ctrl+Space you don't get proper choice.
Whole lot of "something wasn't inlined" hints though.I cleaned the inlines a bit, so the compiler noise about this should be smaller.
Why are there still so many alternative implementations for Generics?
The Delphi compatible generics library is not yet delivered in a release.Just in case, LGenerics is incompatible with Delphi.
... Will test.Thank you, it would be highly interesting to know if it works on the arm device.
@avk your attachments are invisible for guests.That is normal.
@avk your attachments are invisible for guests.Doesn’t it depend on the forum settings?
Slightly improved sorting algorithms performance.Can you give more info about your benchmark env (VM, CPU, RAM, optimization switches, C++ source code)?
Below are results of some comparison benchmarks, first plot is about pascal sortings:A negative value indicates that the algorithm failed the test(exhibits quadratic behavior).
- Delphi denotes Delphi.Generics.Collections.TList<Integer>.Sort
- Fgl - fgl.TFpgList<Integer>.Sort
- GCol - rtl-generics.Generics.Collections.TList<Integer>.Sort
- Fcl - fcl-stl.TOrderedArrayUtils.Sort(TVector<Integer>)
- Lg - LGenerics.TGVectorHelper.Sort(TGVector<Integer>)
win7-64bit, fpc-3.3.1-r44056, Delphi 10.3 CE;
The second one shows comparison with c++ sortings on a virtual Linux machine(gcc 7.3.0).
Doesn’t it depend on the forum settings?Yes. Being able to view (or upload) is dependent on forum membership.
What about 10**7, 10**8?What about 10**555 ?
Can you give more info about your benchmark env (VM, CPU, RAM, optimization switches, C++ source code)?Oh sure. This is Ubuntu MATE 18.04 with 2 GB RAM on VirtualBox 5.2.26. The host system and processor are listed above.
There shouldn't seem to be any problems, but to be honest, I haven't tried.
Only the simplest SaveToStream/LoadFromStream.
Also, does DistinctEdges return cached value, or does it recalculate list on the fly (from adjacency matrix?)?The iterator simply traverses the vertex adjacency lists.
Provided that you do not remove the vertices and edges of the graph while manipulating with it, this can be done in the destructor.Well ... I do remove elements... so I wrote
Provided that you do not remove the vertices and edges of the graph while manipulating with it, this can be done in the destructor.Well ... I do remove elements... so I wrote
function TMyGraph.DoRemoveEdge(aSrc, aDst : SizeInt) : Boolean; var edg : TMyGraphEdge; begin Result := false; if GetEdgeDataI(aSrc, aDst, edg) then begin Result := inherited DoRemoveEdge(aSrc, aDst); if Result then edg.Free; end; end;
@sash, eventually I added TGSimpleObjGraph. It would be interesting to know your opinion.
- what happens with orphaned edges (when both connected vertices deleted)?
- can I replace an existing instance of vertex like
But the latest revision of the library will do this automatically(provided that the graph owns the vertices).Do what? Free old contained object on assignment of new one?
The TBmSearch entity implements a Boyer-Moore incarnation called Fast-Search, and TBmhrSearch implements the Boyer-Moore-Horspool-Raita algorithm(sometimes just Raita). TBmSearchCI is a case-insensitive version of TBmSearch.Nicely done!.