App Qt + sqlite working in Windows is slower than Mac OS?

Do not consider for trolling, but it happened.


Writing a parser for text files — for each file: in the OP reads, processes, writes the result in sqlite.

Developed on Mac OS — all was OK, could not get enough. Tried on Windows and was surprised. The speed of the target application is clearly less — and in Mac OS General CPU utilization during work of the program was usually under 80-90 percent, and then around 10-20. On Mac OS — GCC, on Windows mingv and vs2010.


Someone faced with such? Any ideas?
October 8th 19 at 02:01
3 answers
October 8th 19 at 02:03
And the optimization flags used? If no optimization (-O0) what are the results?
Have yet to be invented. Possible problems due to the different speed of responsiveness of FS or because of differences in system calls to lock files (try to make all the code to work with the FS in a separate Bibliotheque API to be rewritten for each OS separately). Need code to watch. - Herminia.Kuhic commented on October 8th 19 at 02:06
Thanks, the optimization flags are not used and not fumble. What kind of "beast", where do you suggest I read up on it?
In General the app is small, all the code to work directly with FS in a separate file and uses the Qt API QFile, QFileInfo, QTextStream. Still confused by the fact that you are using sqlite — maybe he's somehow acting improperly and should attempt to buffer his work. But then it is unclear how you will operate the queries of sqlite is not yet "reset" the buffer. - Destany.Powlowski commented on October 8th 19 at 02:09
Flags are set in the project settings in visual studio. You at least release version of collect? - xander_Kozey commented on October 8th 19 at 02:12
Yes, release. But again I don't use visual studio, Qt Creator, visual studio basically took only the compiler, because he sinned in MinGV. - Destany.Powlowski commented on October 8th 19 at 02:15
Add /O2 in the project file(.pro) to the compiler options. - xander_Kozey commented on October 8th 19 at 02:18
More: create a db in memory, to understand whether there is problem in FS. setDatabaseName(":memory:"); - xander_Kozey commented on October 8th 19 at 02:21
Thank you! When creating in memory, the program works quickly... Googled what is practically a classic problem that occurs if you do not use transactions. Tried to use — now "*.db" file, nothing is saved after completion of the program remains "*.db-journal". Perhaps the theme of "curvature of hands" is not solved... - Destany.Powlowski commented on October 8th 19 at 02:24
It seems the problem I have is the wrong approach to the organization of work with databases... Like trying to open a transaction:
bool QDBModel::transaction()<br> {<br> QSqlDatabase db = QSqlDatabase::database();<br> if ( !db.open() ) {<br> QMessageBox::critical( 0,<br> qApp->tr( "Cannot open database" ),<br> qApp->tr( "Unable to establish a database connection." ) <br> QMessageBox::Cancel );<br> return false;<br> } else {<br> //bool flag = db.transaction();<br> bool flag = db.driver()->beginTransaction();<br> qDebug() << db.lastError();<br> return flag;<br> //return db.transaction();<br> }<br> }<br>

Ie the idea was to make all the database operation in one class, include it where necessary and to pull his methods. But in this case, when cleaning automatic variable db transaction "dying." So? - Destany.Powlowski commented on October 8th 19 at 02:27
Excuse me, first why-that did not work tag code, and secondly, I showed that the debug console is depicted. Did logging for transaction start and commit (for rollback too, but, judging by step-by-step debugging, it is never invoked). See this:
Debugging starts
QSqlError(-1, "", "")
QSqlError(-1, "Unable to commit transaction", "cannot commit — no transaction is active")
QSqlError(-1, "Unable to commit transaction", "cannot commit — no transaction is active")
QSqlError(-1, "Unable to commit transaction", "cannot commit — no transaction is active")
...
QSqlError(-1, "Unable to commit transaction", "cannot commit — no transaction is active")
QSqlError(-1, "Unable to commit transaction", "cannot commit — no transaction is active")
QSqlError(-1, "Unable to commit transaction", "cannot commit — no transaction is active")
QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work.
Debugging has finished - Destany.Powlowski commented on October 8th 19 at 02:30
October 8th 19 at 02:05
in vs2010 there is a wonderful Profiler — test. Without the code and the profiling results You no nothing worthwhile to say.
The Profiler is included in the Express version? To buy the Studio for specific small tasks don't want a "break"... also somehow don't want :) - Herminia.Kuhic commented on October 8th 19 at 02:08
Well, you can download the test version, you can use the Profiler from intel or anyone else. Just no real data is not enough, what can I say. - Destany.Powlowski commented on October 8th 19 at 02:11
PS a Good trend that people no longer want to have broken software. - xander_Kozey commented on October 8th 19 at 02:14
October 8th 19 at 02:07
Can be on Windows your app depends on speed of hard drive (in the resource monitor you can see)? If Yes, then you need to force the system to cache the desired data in memory: edit the settings sqlite, move some files to the ram disk or something.
And you can read more? To start how to see this in resource monitor? Sam sin on operation of I / o, but how to confirm it — difficult - Herminia.Kuhic commented on October 8th 19 at 02:10
Task Manager -> Performance -> resource Monitor -> Disk. There will be seen the speed of reading/record for each process and total, as well as the files that there is an active access. You will need to compare the speed with the maximum speed of the drive (it is possible to estimate depending on the model or measure it with some utility). - Destany.Powlowski commented on October 8th 19 at 02:13
Is Win7, or what? - xander_Kozey commented on October 8th 19 at 02:16

Find more questions by tags macOSSQLiteQt