Search the Community
Showing results for tags 'performance'.
Found 8 results
-
Our team have a big problem now but I don't expect people here have the complete solution. Maybe I get a hint. Background I work in a team with for developers. We maintain a big ERP desktop program for transport logistics. Size is about 9 MLOC but that include Devexpress grid and components. The company have about 200 active users. What is a bit unusual is that we use Bold for Delphi as framework between database and application code. That means 99% of SQL for read and 100 % of write queries are generated by Bold. Application is deployed on GCP (Google Computing Platform). The code is far from perfect, there is for example random exceptions in a dialog that handle ferries... We made a patch 29 April morning. People worked normal on that day. Next day 30 April we got reports on slow performance. Slow SQL queries are logged. So I checked that 24 - 29 April there was about 80-90 queries per day that took more than 15 seconds. 30 April and forward there was 200-400 queries per day. There is a slight increases of deadlocks. Now 30 - 40 per day. Previosly it was 15 - 25. I don't get it. Previous patch was made 11 April. Commits in git after patch was not so complicated. A new column was added to a table that replaced a calculated value for vehicles driver. And reads of that was also significantly faster. And also some other minor changes. Anyway if the patch is the reason 29 April should also been a slow day. It wasn't. This is a sample slow query. PlanMission table represent a Trip for vehicle. But each vehicle unit have own insteance. So for example if a truck combination consists of a hauler and a trailer that is 2 PlanMissions. The PlanMission.Trailer link is connected in that case. The purpose of query is to have one row per combination. Trailers are excluded. 2025-05-06 10:13:05:801 (21820) PERF: TBoldUniDACQuery.Open took 58.803 seconds (0.000s cpu) 1 sql for SELECT PlanMission.bold_id FROM PlanMission WHERE (statePlanOpen > 0 OR stateInProcess > 0) AND PlanMission.bold_id NOT IN (SELECT Trailer FROM PlanMission) It took almost a minute to execute. Result is around 1000 rows. One thing I thought about is that we have always used READ_COMMITED isolation in MS SQL Server database. I am no DB guru but that means if any row in the result is updating but not committed queries like above have to wait until done. Advantage is that read query got the latest data. Disadvantage is that user have to wait for the result. But write queries should be fast so don't know either.... If I run query above it takes 0 seconds but that might use the cache in database so maybe not fair comparison. Other things to mention. There is a big project to improve logging but it is not in production yet. Unfortunately that would be handy now. Currently the log is written to a text-file. One per user and session. In the future all logs will be sent to a LogManager application that save it in a logdatabase instead. This will make it easier to analyze problems where different users read and write same data. That is also a problem we had in the past. A group of users both read and modify vehicle-trips and parcels. This is slow. But currently much slower than normal. Can only guess of the reason. It can be the patch. Or it can be some other external issue that came now. As I said I don't expect a solution but maybe a discussion that generate ideas 🙂
-
Worker thread queue performance
snowdev posted a topic in Algorithms, Data Structures and Class Design
I have an application which continuously receives websocket data and proccess them in the background on worker threads. Some data is critical and must be proccessed as quickly as possible. Once I receive the websocket data I fill a TObject descendent with the information and push it to the corresponding worker thread, which proccess and frees the object. I use Delphi 12. I would like to reduce as much overhead as possible in the flow, and beside the business rules, I believe there is an overhead in my worker thread consumer implementation, especially because I work with TObject descendants to transport the data. Also there has TObject cloning when the communication occurs from worker thread to worker thread, because each worker thread owns the queue objects lifetime, so I need to send a copy for each worker thread. I decided to make a benchmark to check by myself the differente in the differet approachs that I know about threading queues and know what has the best performance, attached has the benchmark I build. Nowdays I use CustomQueueObject.pas queue model in prod. In the example, has 4 examples of threading consumer queues: -A thread with TQueue<TObject>, TSempahore and TCritical Section; -A thread with TQueue<Pointer>, TSempahore and TCritical Section; -A thread with internal TThread queue processing TObject descendents, without events and sync objects; -A thread with internal TThread queue processing Pointers, without events and sync objects; After making tons of tests, for my surprise the fastest consumer queue is the example in CustomQueueObject.pas (which I already use), even with more creation/deletion and access control (sync object)... what brought me here to ask more experienced developers if I doing something wrong (according my examples as is my base). Mainly on Pointer examples as I rarely use pointers but I willing to change if its better. In my mind the internal thread queue would much more efficient for the reasons said above... I also thought that work with Pointers could highly improve the overal performance as in the workflow since I would have a single reference and only freed in the final. Could I be measuring the performance incorrectly? Thanks in advance! MultithreadingQueueBenchmark.zip- 30 replies
-
- multithreading
- queue
-
(and 5 more)
Tagged with:
-
Dictionaries, Hashing and Performance
Clément posted a topic in Algorithms, Data Structures and Class Design
Actually I guess is the other way around! The more expert I get the more refactoring I do! As @Lars Fosdal said, cryptic code, WTF was I thinking code, Code that could benefit from modern RTL code if there's no performance penalty. For example: For lPair in SomeObjectList is slower than for i:= 0 to SomeobjectList.count-1. So I won't refactor it. Depending where the code is placed, I will use one form or the other. Replacing TStringList (used as dictionary) with a TDictionary/TDictionaryObject makes a huge diference!- 59 replies
-
- tdictionary
- tstringlist
-
(and 2 more)
Tagged with:
-
The profilers for 64 bit applications developed with Delphi XE2 up to Delphi 12 and for 32 bit applications developed with Delphi 5 up to Delphi 12 are released. ProDelphi mesures 32 bit applications, ProDelphi64 measures 64 bit applications. Prodelphi6432 measures both. All ProDelphi versions measure how many CPU-cycles a method (procedure or function) uses during execution. Measurement is independent from CPU mode at execution time (normal, boost or power save mode). Even a mode change during execution does not matter! After measurement the cycles are converted into time units by the viewer considering the CPU speed. UI languages selectable: English, German, Dutch, French, Italian Downloads of the limited Freeware Version measuring 20 methods are available at https://www.prodelphi.de. The professional version can measure up to 65500 methods.
- 4 replies
-
- profiler
- runtime measurement
-
(and 1 more)
Tagged with:
-
Nevermind.. solved the issue.. !
-
Hi, I am trying to rewrite a piece of legacy code which inserts a number of records in a bulk to SQL server tables(Total number of lines is around 200000 across 15 tables). Currently it uses ADO query to insert multiple records one by one. If the number of records are too high then this process takes a lot of time. I was trying to make it faster and came across FireDAC array DML and according to the documentation, inserting 100000 records can be done less than a second! So I implemented it and in my development machine (where application and database resides) it improved a lot. From 8 minutes to less than a minute. But when I tested it on a test environment where application and database resides on different machines connected by a network, performance is worse. (It was taking 10 minutes with ADO and with array DML it takes 15 minutes) I can't figure it out why array DML insert is taking more time than normal record by record insert. Any ideas? Delphi version: Delphi 10.4 SQL Server: 2017 SQL Driver: ODBC DRIVER 17 FOR SQL SERVER Kind regards, Soji.
- 4 replies
-
- array dml
- performance
-
(and 1 more)
Tagged with:
-
Anyone else notice performance issues for iOS from 10.3.2 compilations?
Sherlock posted a topic in Cross-platform
I have an FMX project that is mainly reading csv files and turns the numerical data into plots (more detailed: measurements over time, with 4 measurements per second). It has been performing "so so" for iOS which caused me to not leave beta phase. Windows performance is way better. That was 10.3.1. Now in 10.3.2 I see almost the same performance in the iOS simulator (still iOS 10.3 only, thought that was being fixed in this release), but on the real device (5th gen iPad) it is way, way slower. I will of course enter lots of stopwatches to check what exactly is costing time, but before that I just wanted to check if anyone else has noticed this as well. Cheers -
I recently switched from Win7 and D2007 to Win10 and Delphi 10.1 Berlin. I use VmWare workstation VMs. Many new things to explore. But I noticed one thing. To open projects and forms is much slower now. I Googled it and found an older post claiming that rename livebinding bpl could improve speed. I am sure we will never use livebinding in our code. Any comments how to improve speed i the IDE?