Mike Torrettinni
Members-
Content Count
1509 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Mike Torrettinni
-
Wow, very impressive! And performance is pretty much the same for long hex strings (8096 chars) and short strings (6 chars): cHexRange = 16777216; cHexLen = 6; HexToBin2 = 1243; HexToBinMahdiOneShot = 430; Diff: HexToBinMahdiOneShot = -65% cHexRange = 100000; cHexLen = 8096; HexToBin2 = 5020; HexToBinMahdiOneShot = 1753; Diff: HexToBinMahdiOneShot = -65%
-
My benchmark shows that Mahdi's HexToBin2 is still faster then HexToBinAsm32. Actually, the longer the Hex string, the bigger difference between them - at 1024 hex chars string, HexToBinAsm32 double's the execution time: cHexRange = 16777216; cHexLen = 6; HexToBin2 = 818; HexToBinAsm32 = 1208; Diff: HexToBin2 = -32% cHexRange = 800000; cHexLen = 1024; HexToBin2 = 2035; HexToBinAsm32 = 4506; Diff: HexToBin2 = -54% You don't get the similar difference?
-
@Mahdi Safsafi you are the winner! ๐ I benchmarked 3 methods and results are like this: (time in ms) fncMyHexToBin (Emailx45) = 15722 = 100% Hex2Bin (Mike) = 6170 = 39% HexToBin2 (Mahdi) = 925 = 5% I assume using Pos, For loop and string concatenation kills our performance, @emailx45, while Mahdi's doesn't use any of it. Of course, credit goes also to @David Heffernan because Mahdi's function is evolution of David's example. Thanks! ๐
-
Aha, pretty neat trick. Thanks!
-
@David Heffernan What does this do?
-
This is what I use: // aHex is expected hex string of chars: 0..9, A..F function Hex2Bin(const aHex: string): string; const // Array of [hex, binary] pairs cBinArray: Array[0..15, 0..1] of string = (('0', '0000'), ('1', '0001'), ('2', '0010'), ('3', '0011'), ('4', '0100'), ('5', '0101'), ('6', '0110'), ('7', '0111'), ('8', '1000'), ('9', '1001'), ('A', '1010'), ('B', '1011'), ('C', '1100'), ('D', '1101'), ('E', '1110'), ('F', '1111')); var i: integer; x: string; begin Result:=''; // Iterate hex string for x in aHex do // For each hex char find binary result in cBinArray for i := Low(cBinArray) to High(cBinArray) do if cBinArray[i, 0] = x then begin // Concatenate binary results Result := Result + cBinArray[i, 1]; Break; end; end; Note: it expects valid Hex string input (0..9 and A..F chars), so if you need to validate if input is valid hex string, or make it UpperCase (a..f -> A..F), make necessary checks.
-
This is just a theory, concept question, just to see if it makes sense to explore: I have an activex charting control and I only have 32 bit version, old control that can't be replaced, yet. This is one of the things preventing me to move project to 64 bit. I was thinking of wrapping this control into 32 bit dll with Form/Frame and then I can move the project to 64 bit and integrate the Form/Frame from the dll. I have no experience with dll that can show visual controls, Forms/Frames. Right now I have this charting control attached to the PageControl Tab, I assume I can a show the same chart from dll. Is this worth exploring or 32 bit dll with form/frame can't be used in 64bit project?
-
Can 32bit dll with Form/Frame be used in 64 bit project?
Mike Torrettinni replied to Mike Torrettinni's topic in VCL
Hm, not sure this would be acceptable for users. Or perhaps they might just accept it, if the feature works and is useful for them, they might accept the fact that it shows up in another program. Will think about it. Thanks! -
Can 32bit dll with Form/Frame be used in 64 bit project?
Mike Torrettinni replied to Mike Torrettinni's topic in VCL
Aha, thanks. I used WM_COPYDATA before, so if it works, I will try this and not to go too far into the unknown. -
From the November 2020 Roadmap comments: https://blogs.embarcadero.com/rad-studio-november-2020-roadmap-pm-commentary/ "That continues in 10.4.2, with one area of significant work being the new Delphi Code Insight (aka Delphi LSP.) Not only will 10.4.2 include many fixes and tweaks, as well as less commonly used code insight features that we did not include in the initial version, but also some new or significantly improved features in code completion. For example, we plan to add ctrl-click on โinheritedโ, as well as reworked completion in โusesโ clauses, among others." I can't wait! I think LSP has so much more potential to be really very well implemented in Delphi. I hope Embarcadero's enthusiasm for this feature doesn't wane until is really useful, even for large projects. And: "We also plan further quality work around desktop layouts, multi-monitor layouts, form designing, and similar areas. This includes allowing you to design your form in the form designer at the same time as having the code for that form open. From feedback, this was the most common reason for using the old undocked designer, which we removed in 10.4.1, and weโre glad to let you both code and design in a form unit using the modern designer." I never used the old style, not sure why not, but if this will be implemented in a way to be really useful, I will definitely use it! Good thing are coming in Delphi in 2021! ๐
-
Can 32bit dll with Form/Frame be used in 64 bit project?
Mike Torrettinni replied to Mike Torrettinni's topic in VCL
Yes, I agree, that is long term plan. All the charting components I looked at would require some customization for same results. So, no good replacement/solution has been found, yet. -
Can 32bit dll with Form/Frame be used in 64 bit project?
Mike Torrettinni replied to Mike Torrettinni's topic in VCL
Interesting, Do you remember any big issues or was it as easy as you describing it? Can you rephrase this, please... I'm not sure you are suggesting to use API or NOT to use API? Could WM_COPYDATA be used for communication? -
Can 32bit dll with Form/Frame be used in 64 bit project?
Mike Torrettinni replied to Mike Torrettinni's topic in VCL
Thanks! -
Anyone who uses FastSpring as the payment processor received their payment for the last month?
Mike Torrettinni replied to Edwin Yip's topic in General Help
It's always that one time you need something and it exposes the weak point. 2Checkout also has a new platform for a few years now, I think after they 'merged' with Avangate, and the main product screen doesn't show product price ๐So, expect awesome new design, with little exceptions, like no product price in main product list. -
Anyone who uses FastSpring as the payment processor received their payment for the last month?
Mike Torrettinni replied to Edwin Yip's topic in General Help
Did you get the payment, on 15th? I've had a few payment processors and every now and then I read reviews on competition and I can tell you that over the span of years, there is no one-best, all the time. As any other business they all go through ups and downs, either because of change of management, being sold and it takes time to integrate with new company, or they change their core technology and takes time to polish out bugs, or outsource the customer support... It's annoying to catch their cycle on the down-side, when they have problems. I've been trying to get away from 2Checkout for over a year now, after disastrous few months when they were resolving my issue (at the time they just outsourced their support and were in the process of being sold). So, I needed their support at their worst time. But after that, they are back and as reliable as before, but I never needed to contact their support again. So, still deciding what to do. Based on your post, I will probably skip evaluating FastSpring as potential new processor, for now. -
Why is public class method marked as used, while it's not actually used?
Mike Torrettinni posted a topic in Algorithms, Data Structures and Class Design
I was refactoring some code and removed all calls to a method of a class, but it was still showing 'blue dots' in editor indicating it was still used. The 'blue dots' were removed when I moved the method from public to private section. Here is example and screenshot of 'blue dots' showing as if procedure B is used, but I don't actually call it, I just create a class: and if I move procedure B to private, the nothing is used: And the code: type TDummy = class private procedure A; procedure B; end; procedure TDummy.A; begin Sleep(0); end; procedure TDummy.B; begin Sleep(0); end; procedure TForm2.FormCreate(Sender: TObject); var vDummy: TDummy; begin vDummy := TDummy.Create; end; I assume that is by design. Does somebody know why is procedure B marked as used? I couldn't find resource on this. -
Why is public class method marked as used, while it's not actually used?
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Would be nice. Can you imagine how long it would take Embarcadero to implement this? ๐ -
Why is public class method marked as used, while it's not actually used?
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Is this true? The 'blue dots' are relevant after compile is done, so 1 unit or 1000s of units inproject, after compile IDE should know what's used and what not, right? Of course referring to local units, not packages or dlls... -
Why is public class method marked as used, while it's not actually used?
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Aha, I get it now. Well, I tested it anyway, just in case ๐ -
Why is public class method marked as used, while it's not actually used?
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
OK, I tried defined as class method , I don't notice any difference: As suggested, if I disable RTTI, then the method is really not used (not generated) if not used: -
Why is public class method marked as used, while it's not actually used?
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Isn't a method that is defined in a class, a class method? Should it be class' method? -
Why is public class method marked as used, while it's not actually used?
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Aha, OK, it makes sense. I thought it was just generics and unicode that doubled/tripled... the size of executable from Delphi 2009+. -
Why is public class method marked as used, while it's not actually used?
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Thank you, I do understand that you can call B from outside of the class. Why does it require to generate public method, even if is not actually being used, anywhere? It doesn't do the same with other methods not inside the class like global methods. -
I read this explanation why Everything tool is so fast in indexing and searching filenames: "Searches are compiled into byte code and executed." Here: https://www.voidtools.com/forum/viewtopic.php?f=2&t=9463 Is this same as compiling on the fly and executing the code, like this question: https://stackoverflow.com/questions/16318136/can-i-compile-the-code-on-the-fly-in-delphi-and-execute-it/16319062 ? My understanding is that all code is compiled and executed in runtime, we just add some parameters, values from UI and other input. Does anybody have any simpler explanation, or what is meant as 'compiled into byte code and executed'? Is that some new trick to optimize, speed-up code execution? Thanks!
-
Yes, probably the tool does a lot of things to make it fast (apart from the obvious accessing and creating big index files). It's been around for many years, so I assume it's using a lot of other performance tricks, along with bytecode searches, and they all add a little here and there. Thanks for another view on this and examples.