Leaderboard
Popular Content
Showing content with the highest reputation on 03/30/21 in all areas
-
QueryPerformanceCounter precision
David Heffernan replied to Mike Torrettinni's topic in Windows API
Am I the only one who finds it odd that we have a two page thread on replacing TStopwatch with QPC when in fact TStopwatch is QPC. Perhaps somebody else could point out to @Mike Torrettinni that when he says It's actually what he had originally with TStopwatch. -
Resource Hacker A resource editor for 32bit and 64bit Windows applications. It's both a resource compiler and a decompiler - enabling viewing and editing of resources in executables (*.exe; *.dll; *.scr; etc) and compiled resource libraries (*.res, *.mui). Resource Hacker also provides many options for compiling and decompiling resources from the command-line. http://www.angusj.com/resourcehacker/ Download: http://www.angusj.com/resourcehacker/reshacker_setup.exe
- 3 replies
-
- resource compiler
- resource editor
-
(and 1 more)
Tagged with:
-
Hi, You can use the code in https://www.delphipraxis.net/1486219-post6.html to make a TWincontrol (semi)transparent (not just a stringgrid). Use it for a black panel, set its parentbackground to false and alignClient it on the tabsheet. I tried it with Delphi 10.3.3 CE.
-
Range Check Error ERangeError
Stefan Glienke replied to david_navigator's topic in RTL and Delphi Object Pascal
Don't blame the developer - blame the poor hints - taken from Delphi XE and 10.4: Before anyone tells me to report it - been there, done it! https://quality.embarcadero.com/browse/RSP-17110 The cast to Integer is indeed wrong - see the assembly code with Bounds checking enabled: Unit2.pas.31: PostMessage(Handle, CM_SEARCH, Integer(Sender), Key); 0060F70F 8B45F4 mov eax,[ebp-$0c] 0060F712 0FB700 movzx eax,[eax] 0060F715 50 push eax 0060F716 8B45F8 mov eax,[ebp-$08] 0060F719 85C0 test eax,eax 0060F71B 7905 jns $0060f722 0060F71D E80686DFFF call @BoundErr 0060F722 50 push eax 0060F723 6800CA9A3B push $3b9aca00 0060F728 8B45FC mov eax,[ebp-$04] 0060F72B E8406EF4FF call TWinControl.GetHandle 0060F730 50 push eax 0060F731 E82A67E0FF call PostMessage With cast to WPARAM: Unit2.pas.31: PostMessage(Handle, CM_SEARCH, WPARAM(Sender), Key); 0060F70F 8B45F4 mov eax,[ebp-$0c] 0060F712 0FB700 movzx eax,[eax] 0060F715 50 push eax 0060F716 8B45F8 mov eax,[ebp-$08] 0060F719 50 push eax 0060F71A 6800CA9A3B push $3b9aca00 0060F71F 8B45FC mov eax,[ebp-$04] 0060F722 E8496EF4FF call TWinControl.GetHandle 0060F727 50 push eax 0060F728 E83367E0FF call PostMessage To reproduce try enabling top down memory allocation in your windows which will cause the Sender pointer to be large enough that it will be negative when cast to Integer -
Yes, I was wondering the same. There are only two reasons not to use TStopWatch: You are using a Delphi version that didn't have that yet (e.g. Delphi 2007) You want to play with various options.
-
For microbenchmarking you don't need that high of a precision - you simply run the benchmarked function thousands of times and then divide by the number of runs and you got your duration. Watch some videos by Chandler Carruth like these two:
-
Pascal bindings for PrimeSieve library - https://github.com/JulStrat/primesieve-pas. Examples provided. Tested with Rio 10.3 CE. it's my first code for Delphi. Suggestions and critics are welcome ...
-
Range Check Error ERangeError
Attila Kovacs replied to david_navigator's topic in RTL and Delphi Object Pascal
Reload my comment. 😛 -
Range Check Error ERangeError
Remy Lebeau replied to david_navigator's topic in RTL and Delphi Object Pascal
32bit vs 64bit? You really should not be casting to Integer at all. Cast to WPARAM instead, which is what PostMessage() is expecting procedure TEqlistFrm.VenueEditMainKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin PostMessage(Handle, CM_SEARCH, WPARAM(Sender), LPARAM(Key)); end; -
QueryPerformanceCounter precision
David Heffernan replied to Mike Torrettinni's topic in Windows API
That's nice. But it's off topic here. -
QueryPerformanceCounter precision
David Heffernan replied to Mike Torrettinni's topic in Windows API
Well yeah, that's to be expected. And it's not just QPC. If the processor runs in a slower mode, then you code will be slower. And of course when you measure it, that will be reflected, no matter how you measure it. -
Google benchmark also uses GetProcessTimes - here is an article about the differences. And there you can also see why benchmark does a certain number of iterations on the profiled code to ensure a certain overall duration (the number of iterations dynamically depends on the single duration of the measured code) - as you can also see in the presentation from Chandler I linked earlier Another consideration with all these methods is once you benchmark multithreaded code the wall time might not be the information you want.
-
There aren't any options with QPC. It just returns a 64 bit int. Which TStopwatch passes on to you. And the performance counter frequency is also available. There are alternative options to using TStopWatch, that's what I meant, e.g. using GetSystemTimeAsFileTime, GetTickCount, GetTickCount64. I'm not suggesting to use these for high precision timing in general, they are just options for some particular cases, e.g. if you don't want an Int64 but an Int32 for whatever reason.
-
QueryPerformanceCounter precision
David Heffernan replied to Mike Torrettinni's topic in Windows API
You said that you were replacing TStopwatch with QPC, but TStopwatch is implemented using QPC. So this entire effort is pointless. That's my point. TStopwatch.Frequency comes from a call to QPF. TStopwatch.GetTimeStamp is QPC. And TStopwatch.ElapsedTicks is the difference between QPC when you started the stopwatch, and QPC when you called ElapsedTicks. I guess you were previously calling TStopwatch.ElapsedMilliseconds and wanted more precision. Which you can get by switching to TStopwatch.ElapsedTicks. -
I might be missing something, but if you need to do that, why are you omitting the override; behind your declaration?
-
ZEOS 8.0.0 /trunk svn 7412(/branches/8.0-patches svn 7413) NEW: Fixes for cooperation with dbgrid. https://zeoslib.sourceforge.io/viewtopic.php?f=50&p=169529#p169529 https://sourceforge.net/projects/zeoslib/ https://github.com/marsupilami79/zeoslib Feel free to download, testing, use, submit comments. Michał
-
LATEST INTEL PERFORMANCE LIBRARIES
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
I have deleted the repositories because somebody pointed me about problems with intel license IPP and redistributables (seems that intel permits to redistribute for free the complete 30MB of dlls with the compiled exe, but don't cover over custom thiny dll as I used). btw: with TBBMalloc there are no problems of redistribute https://github.com/oneapi-src/oneTBB here the sources and here a delphi wrapper for tbbmalloc https://sites.google.com/site/scalable68/intel-tbbmalloc-interfaces-for-delphi-and-delphi-xe-versions-and-freepascal -
QueryPerformanceCounter precision
Mike Torrettinni replied to Mike Torrettinni's topic in Windows API
Thanks, I need a little more precise. If testing StringReplace there could be 1000s of executions within 1ms, if benchmarking some long sort that takes seconds, than it could be enough. So, I need single approach that covers most cases, so more precise. QPC is enough. -
if milliseconds are precice enough, two calls to Now and subratract like ms := MillisecondOfTheDay(SecondNow) - MillisecondOfTheDay(FirstNow); can do it?
-
Thanks KodeZwerg. 😁
- 3 replies
-
- resource compiler
- resource editor
-
(and 1 more)
Tagged with:
-
I wish someone with some C++ knowledge would write a Delphi wrapper for Google Benchmark
-
QueryPerformanceCounter precision
David Heffernan replied to Mike Torrettinni's topic in Windows API
TStopwatch is implemented on Windows using QueryPerformanceCounter...... -
Isn't that the reason you are here? https://quality.embarcadero.com/browse/RSP-28708
-
XML Parsing and Processing
Andrea Raimondi replied to pyscripter's topic in RTL and Delphi Object Pascal
We disagree on the notion that the performance is an issue 🙂 I think it's not, given how much stuff you can do out of the box. I would also like to point out that OXML is quite a neat library, we use it for importing Excel (xlsx ones) and it's awesome.