Jump to content

Stefan Glienke

Members
  • Content Count

    1498
  • Joined

  • Last visited

  • Days Won

    152

Everything posted by Stefan Glienke

  1. Stefan Glienke

    CPP or C++ Category

    Why should a Delphi forum have a C++ area?
  2. Possible copyright violation as it contains code related to DXScene and VGScene which was/is under copyright by Eugene Kryukov and was sold to Embarcadero.
  3. Stefan Glienke

    does a class property or a variable exist

    RTTI does not contain any information about class properties or vars/fields For clarification please see my P.S. in this post.
  4. Stefan Glienke

    where can I get general git process questions answered?

    Sounds more like current git workflow is done wrong when there is a struggle with 3 people trying to use it - because git was exactly invented for a distributed team (linux kernel). There are several models out there that have pros and cons - the famous one from over 10 years ago (which I saw had a note added earlier this year): https://nvie.com/posts/a-successful-git-branching-model/ This one refers to another one: https://guides.github.com/introduction/flow/ And since gitlab is a competitor to github they also have their model: https://docs.gitlab.com/ee/topics/gitlab_flow.html Read up on those - try to understand - identify which one fits your situation best and then come back asking some specific questions
  5. Stefan Glienke

    Why is TList freed in this code?

    What do you mean how does it behave - like a multimap
  6. Stefan Glienke

    Why is TList freed in this code?

    That's why IMultiMap<TKey,TValue> from Spring4d is so cool
  7. Stefan Glienke

    a pair of MM test

    I know english is not your native language but to be honest just throwing around numbers and all kinds of different benchmarks it totally confusing for me - it would be very helpful if you could present your findings in a more structured way as I really find the topic interesting but it is very exhausting to follow you.
  8. Stefan Glienke

    a pair of MM test

    Thanks, might be worth putting that info into the github readme because right now this looks like the Sea*.dll are yours where no code nor their source is found for in the repo. Also apart from the raw speed numbers do you have total/peak memory allocated comparisons for the tests you mention as well? Edit: what is the "FastMM5 benchmark utility" you referring to? I see no benchmark in the FastMM5 repo
  9. Stefan Glienke

    a pair of MM test

    X is n times faster than Y is not leading anywhere unless you profile the bottleneck of Y in your benchmark. Run it under VTune or uProf and report your findings. As for your MM it might be faster but nobody serious will download and use some random dlls (that are not even signed) from the internet and put them into production.
  10. Stefan Glienke

    Automated Way to Detect Interface Breaking Changes

    Unless you use generics - they are off limits to be changed (interface and implementation section) in both cases - also for units inline methods are off limits - for packages they are ok because inlining does not happen across binary module boundaries.
  11. Keep in mind this was addressed at Uwes comment that he did not publish something similar because he did not make the effort to make it work not only for his but as a general purpose thing. I cannot speak for others but for me it was reading a lof of collection library code (not only Delphi) - the Delphi specific things (can/cannot use System.Move and such) comes from general core runtime (RTL) knowledge. And sometimes after years it dawns on you that naive usage of generics in large OOP architectures is not the greatest thing and you start refactoring stuff.
  12. Simple: pointers stored in the weakref table in System don't match those after using Move
  13. I disagree - if this implementation were done totally naive it would have actually worked for any T yet in a non optimized way - but the author tried to be clever by using Move 😉 Leave implementing generic collections to people experienced with it (which I in no way claim to have monopoly on) P.S. Since the XE7 refactoring disaster of System.Generics.Collections which still has existing bugs as aftermath I am very sensitive regarding this topic.
  14. I admit - it's not common but good luck storing something like this in your list then: type TMyRecord = record [weak] something: IWhatever; end; I am not bashing any code here but when something is published as general purpose use (which an unconstrained generic collection class is) then I expect it to work for any T. If you don't handle this in your private code because you don't have such use case you of course don't need to care. As for TRingBuffer<T> - it leaks strings for example: var b: TRingbuffer<string>; begin b := TRingbuffer<string>.Create(8); b.Add('one'); b.Delete(1); b.Add(['two', 'three']); b.Free; end;
  15. Read System.Collections.Generics. Particularly the places where it checks for HasWeakRef(T) What weak references are and how they are handled and why you cannot simply System.Move them refer to System.pas (start with RegisterWeakRef)
  16. No, yes For managed types you can System.Move them in the internal array - however it also does it when peeking x items into the result array. For types containing weak reference System.Move does not work even for the internal array.
  17. Spring4d 2.0 already has this: https://bitbucket.org/sglienke/spring4d/src/c336b8dd39bfc30cbcf2fa1f6d8323e663bdcc05/Source/Base/Collections/Spring.Collections.Base.pas#lines-473 It is an abstract base class (you don't simply use that one) implemented by several different ready to use collections such as queue, deque, boundedqueue (does not grow like queue does), evictingqueue (drops the oldest element when full) TRingbuffer<T> unfortunately has several defects, mostly around simply using Move regardless the type of T (managed, containing weak reference)
  18. What you refer to is called forking and in fact GitHub is able to track what repositories are a fork and where they originate from. The problem is a different one and that is that often forks are more active than the original one which at some point might be completely inactive. If I were someone actively working on a fork while the original project might be dead I'd reach out to the original maintainer/author and try to work something out.
  19. Yes it is - optimizer does not reorder. If it would short-circuit evaluation would be broken. FWIW setting Result to False and or'ing it with A is unnecessary - x or False = x
  20. That code does not compile, method references cannot be declared as consts. What you probably meant was this: const Funcs: array[0..2] of function: Boolean = (A, B, C); And yes, that only works if they are parameterless otherwise you would have to declare that differently - but again only works if they are have homogeneous signatures. Talking about possibly overengineering: https://en.wikipedia.org/wiki/Specification_pattern
  21. Conditionals probably but certainly not switches.
  22. And what exactly is wrong or not understandable in a week with using {B+} and a simple one liner?
  23. Stefan Glienke

    System.GetMemory returning NIL

    They do by possibly specifying a capacity when creating one. Should I depending on that number either call SetLength which uses GetMem or allocate the dynamic array memory buffer myself? I would rather like to avoid that because that might get quite complicated when we are talking about resizing. That is what I was aiming at - making claims of how x is bad and y is better is all good and sound but what are the concequences for developers that want to benefit from these potential benefits - or does it not matter at all.
  24. Stefan Glienke

    August 2020 GM Blog post

    The alternative to Italic... scnr
  25. Stefan Glienke

    System.GetMemory returning NIL

    As a library developer I have this question after reading all this: how does this affect me. For example collections are an essential part of spring4d and they can be of any capacity from just a few items which fit into a small block up to collections that hold thousands of elements and where SetLength causes the used GetMem to use large blocks. So if anyone claims that the way the MM does it is not good the solution for many places that allocate variable size of memory is not to put if size < x then getmem else virtualalloc but to solve this properly inside of GetMem/the memory manager. Especially since GetMem is indirectly called by many things such as SetLength - if you directly allocate memory for your own sure you can choose one or the other.
×