A
A
Alexander Alekseev2016-07-22 19:57:33
PHP
Alexander Alekseev, 2016-07-22 19:57:33

Why is there such a performance difference between SQLite in PHP and Delphi?

There is a SQLite database the size of a couple of Gigs. The computer has 32 Giga RAM, most of it is free, ie. sooner or later the database ends up in the file cache. The base is used as a dictionary, there are no operations to change, delete or insert, just selects. I make a selection using PHP. For each request I receive in response a record with two fields. The performance is about 15,000 requests per second. If you do this for the first time, then it is many times less, about 5,000 requests per second, but then, apparently, the database gets into the file cache and operations go at a higher speed, which is more or less stable. I'm trying to do the same in Delphi, more precisely in C++ Builder. The speed is about 200 selects per second. The difference is almost 2 orders of magnitude! Although it would seem that the compiled application should run a little faster, the result is just the opposite.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mercury13, 2016-07-22
@Mercury13

1. There is a suspicion that for some reason you do not precompile queries in the C ++ version. The query is compiled every time you execute it. Although it depends on the wrapper - it's hard to work with SQLite with simple C functions, everyone uses wrappers.
2. If you compile SQLite with the classic Embarcadero compiler, it is several times slower than others. Although it cannot give a difference of several orders of magnitude. By the way, such large C-files quickly bug Embarcadero, and it is better to send SQLite to a static or dynamic library.

N
Nazar Mokrinsky, 2016-07-22
@nazarpc

What matters is which version of SQLite the PHP and Delphi applications are built with. I suspect that PHP has a much newer version.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question