Jump to content

Stefan Glienke

Members
  • Content Count

    1428
  • Joined

  • Last visited

  • Days Won

    141

Everything posted by Stefan Glienke

  1. Stefan Glienke

    Embarcadero entries in the path

    Matters if you have many different versions installed which can be typical for library or component developers - and every installation puts quite a bit into the path environment variable. Here is how mine looks (I have XE, 10.1, 10.2, 10.3 and 10.4 installed - and so far it's ok on Windows 10): I did not do the work yet on this Machine but on my older Win8.1 machine i had everything from Delphi 2010 to 10.3 installed and that completely blew the max length of the path variable so I substituted the common parts of the paths (such as programfiles or public documents)
  2. Ugh - just stop it please - first there is a typo resulting in an AV as TS in TSmartPointer.Wrap needs to be of type TInjectType<T> (fwiw these types are not necessary at all as you can just call New(p) and have the correct amount of memory allocated) and second this implementation will leak if you assign TSmartPointer.Wrap<T> to anything that is not nil already.
  3. No, actually pretty good, thank you. 🙂 It's just the experience with issues being reclassified and then "forgotten". And yes it can always be worse is also a way of optimism 😉
  4. Too bad it will most likely rot in JIRA with the other 1900 open as "new feature" classified issues...
  5. And some of it is unfortunately completely unnecessary and applies to every managed type! See https://quality.embarcadero.com/browse/RSP-27375
  6. hardly - its approx 25% to 50% slower because it has to create and destroy an entire object with all bells and whistles. 🙂
  7. Stefan Glienke

    You RAD Studio 10.4 Sydney appreciated features and bug fixes

    @pyscripter Looks weird given how other managed types lifetimes are being handled - but since we don't have precise language and design specs as always we can just guess. Apart from that implementing smartpointer that way is wrong anyway because they break whenever there is an explicit or implicit assignment/copy going on. Proper smartpointer need a shared block that holds a reference counter. Shared<T> in Spring is implemented with several optimizations to avoid the overhead of object creation for this purpose using the all known "interface in record" approach and I challenge everyone to come up with a robust implementation using custom managed records to beat that.
  8. Stefan Glienke

    language updates in 10.4?

    That is only an issue for library authors that need to target a range of past versions which is the vast minority of Delphi users. Most migrate to a new version, start using that and never have to run their code through previous versions. Type inference for inline variables is a really nice thing - no need to explicitly decare the type just to tell the compiler (yes, if you name your variable properly the type is irrelevant for understanding the code, ask programmers from other languages that have this feature for a long time). Also often enough you have to add units to a uses clause just to declare a variable of a type that is the return of a method of some other type being used - with type inference that becomes unnecessary.
  9. I don't understand the original problem - please describe exactly the data in a complete but small enough sample and the way you want it to be organized/shown.
  10. Stefan Glienke

    Fonts & ligatures

    As far as I know the editor control does not support ligatures
  11. Stefan Glienke

    FastMM5 now released by Pierre le Riche (small background story)

    FWIW I have done similar but in many cases just looking at the disassembly does not tell the entire story - running the code and profiling it (which can be a very tedious process given the many different uses cases etc) will often tell a different story and modern hardware architecture just shows you the middle finger. Especially for routines that get inlined in many different places although they might produce a little bit better disassembly it might not be worse or even better in some cases to not inline them if they can be written jump free because the code will be smaller and likeliness of staying in the instruction cache will be higher. But again we are talking about microoptimization here that requires a lot of profiling and looking at some cpu metrics.
  12. Stefan Glienke

    FastMM5 now released by Pierre le Riche (small background story)

    I don't know about the particular piece of code but I absolutely second that - if you can avoid branching, please please do so - unfortunately neat and clean code (an innocent looking if or a loop) can easily turn into a performance drain.
  13. Some of the benchmark results are just eyewash fwiw
  14. Stefan Glienke

    RTTI info for TBytes using runtime packages

    Regardless the current typeinfo issue I would always check for typeKind = tkDynArray (and possibly even tkArray) and ElemType = Byte because then you can also handle any custom declared TMyBytes = array of Byte type.
  15. Stefan Glienke

    RTTI info for TBytes using runtime packages

    The types are assignment compatible. When you declare a variable of TBytes in one module and call a method from a runtime package that uses TBytes that code will compile and work. Just the typeinfo generated is different so if you do some RTTI work you get false results.
  16. Stefan Glienke

    RTTI info for TBytes using runtime packages

    The issue is that TBytes is an alias for TArray<Byte> - generic types being used across different modules have several implications such as that they manifest into each module with their own typeinfo being generated. Try this code for example: uses Rtti, SysUtils; var ctx: TRttiContext; begin Writeln(ctx.GetType(TypeInfo(TBytes)).QualifiedName); end. In a regular console application it will print: System.TArray<System.Byte> While you would assume that it should print: System.SysUtils.TBytes Now if you enable runtime packages for this console application and let it link with rtl you will get an ENonPublicType here. Every module that is using TBytes is not referencing some type that is declared in the RTL runtime package but emiting its own version of TArray<Byte> into its binary. Personally I think this is an issue with the compiler treating the declaration of TBytes = TArray<Byte> different from TBytes = array of Byte in terms of the typeinfo generated - I was sure there is a QP entry somewhere about it but I cannot find it right now. To further provide the proof that aforementioned assumptions of other posters are wrong use the following code with a console application linking with the rtl package: uses Rtti, TypInfo, Classes, SysUtils; var ctx: TRttiContext; begin Writeln(ctx.GetType(TBytesStream).GetField('FBytes').FieldType.Handle = TypeInfo(TBytes)); end. This will print FALSE as the typeinfo of the FBytes field which is of type System.SysUtils.TBytes in fact differs from the typeinfo generated for the usage of TBytes in the console application binary. In fact there does not even exist a type called TBytes but only System.TArray<System.Byte> as TBytes it just an alias as I said and the declaration TBytes = type TArray<Byte> is not legit and raises E2574 Instantiated type can not be used for TYPE'd type declaration
  17. Stefan Glienke

    Difference between Pred and -1

    Fun fact: you can omit the 3rd argument of Copy if you just want to cut from the beginning.
  18. Stefan Glienke

    Find record operators via Rtti?

    https://bitbucket.org/sglienke/spring4d/src/409cf53e4848815ac089763243469226b363d3be/Source/Base/Spring.pas#lines-3806
  19. Stefan Glienke

    Exception.CreateFmt vs. CreateResFmt

    It gets bad if the implicit string or other managed type variables are the only of that type because then you get the implicit try finally added. And at least for win32 we know now that try/finally is implemented kinda badly: https://quality.embarcadero.com/browse/RSP-27375
  20. Stefan Glienke

    Exception.CreateFmt vs. CreateResFmt

    That is why for performance critical code such code should be moved to an extra (or nested) routine. Otherwise you get pro- and epilogue polluted with code that is not necessary in the majority of cases. Additional read: https://www.delphitools.info/2009/05/06/code-optimization-go-for-the-jugular/
  21. Stefan Glienke

    Setting a "nullable" property on a .NET object

    Yes it is, it's a struct
  22. Stefan Glienke

    Overstatic methods

    https://quality.embarcadero.com/browse/RSP-20169
  23. Stefan Glienke

    Generic class

    Generics in Delphi have more severe issues that should be worked on than that tbf
  24. Stefan Glienke

    spring4d list immidiately gets freed

    FToollist is certainly not being freed but the items because the list returned by FindAll has OwnsObjects = True and goes out of scope at the end of the method. Write dm.Session.FindAll<TTool>.MoveTo(FToolllist);
  25. Stefan Glienke

    language updates in 10.4?

    I would like to but I don't (and not because of FUD but because I know of the bugs myself) - do I need to say anything more? Ask around in other languages if people in general trust their compilers and standard runtime libraries or not.
×