sakura 45 Posted July 20, 2020 Hi, just for you guys to weigh in, we have located a bug in the Delphi 10.4 compiler, that removes a totally valid assign statement in RELEASE mode, believing, that the code will never be executed. The actual method is from the mORMot library in releases before last week (unit SynCommons.pas, method TSynAnsiFixedWidth.AnsiBufferToUTF8. A full discussion is available at the mORMot-Forum: https://synopse.info/forum/viewtopic.php?id=5520 . I have reported the bug to Embarcadero: https://quality.embarcadero.com/browse/RSP-30088 . Please check out my report and try to confirm and weigh in there. It should be reproducible. --- Note, the compiler will tell you (Hint H2077), that the value assigned is never used and thus, in RELEASE mode, with optimizations enabled, drop the code completely. Thanks for your time and support 👍 3 1 Share this post Link to post
Arnaud Bouchez 407 Posted July 20, 2020 I have written a blog article about this problem. https://blog.synopse.info/?post/2020/07/20/Special-Care-of-Delphi-10.4 Hope the issue is fixed soon in the next Delphi patch - after the holidays I guess. 🙂 2 Share this post Link to post
Stefan Glienke 2006 Posted July 21, 2020 https://xkcd.com/292/ just saying 6 Share this post Link to post
Tommi Prami 130 Posted July 24, 2020 (edited) As I see using GOTO it is good for optimization with nested loops to get from one level to another, while keeping loop condition simple. Never used it in Delphi I think. Covorker used in very heavy and nested looping to gain speed. But is it always possible to write without goto as same performance. (Hard to give real life example on top of my head). In other words I can't figure out how you would restructure nested loops without including more complex looping condition... -Tee- PS would be funny to rename goto GTFO 😄 Edited July 24, 2020 by Tommi Prami Share this post Link to post
sakura 45 Posted July 24, 2020 Let's not discuss the GOTO - first, it is not my code, but code from a library I use, second, the full method from the library certainly benefits from it. It is not always possible to optimize for everything cleanly. For full details, follow the links 😉 Share this post Link to post
Stefan Glienke 2006 Posted July 24, 2020 (edited) 5 hours ago, Tommi Prami said: But is it always possible to write without goto as same performance. (Hard to give real life example on top of my head). I challenge you to write this method in a more performant way than what it currently is without completely turning it into an even less readable mess: https://bitbucket.org/sglienke/spring4d/src/534d63bccd0891d165d6cee1cbfff18df790661e/Source/Base/Spring.pas#lines-10122 Edited July 24, 2020 by Stefan Glienke Share this post Link to post
MarkShark 27 Posted July 24, 2020 Although I avoid using Goto (and usually With as well) in my own code. I appreciate the library writers who do whatever they can for performance or usability! I think I still use the "super pos" function that was written for the old fastcode challege which has a bunch of gotos and is amazingly fast. 1 Share this post Link to post
Tommi Prami 130 Posted July 25, 2020 16 hours ago, Stefan Glienke said: I challenge you to write this method in a more performant way than what it currently is without completely turning it into an even less readable mess: https://bitbucket.org/sglienke/spring4d/src/534d63bccd0891d165d6cee1cbfff18df790661e/Source/Base/Spring.pas#lines-10122 Kind of my point exactly. I was just asking is there a way to restructure code away from GOTO. I had just gut feeling that is not always possible or that easy... Share this post Link to post