B
B
beduin012015-03-02 15:19:14
SQL
beduin01, 2015-03-02 15:19:14

Does ORM slow you down?

Many times I heard the statement that with ORM any SQL turns into SQLLite i.e. the opportunity to use a bunch of chips of the DBMS itself disappears. Is it so? How much does this affect performance?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
Alexey, 2015-03-02
@rdifb0

Yes, the speed drops if you use it everywhere. Because a bold class is initialized for each entry.

S
Sergey, 2015-03-02
Protko @Fesor

Depends on ORM. Of course, there will be an overhead in terms of performance, especially if you take things like Doctrine with hydration, etc. But the profit in terms of development time and product quality that they give is more than worth all the costs. If the project becomes popular and +30% is an extra rack of servers, that is, paying for servers is already becoming more expensive than for a developer, then it already makes sense to refactor and optimize bottlenecks. But premature optimizations are evil.
As for SQL and DBMS capabilities - Doctrine and many others allow you to use both native queries (+ your own hydrations) and add some of your functions for *QL. Also, many things can be decently accelerated (in the doctrine, the bottleneck is the unit-of-work, or rather, the calculation of the differential of the data that is spinning there. By default, everything is compared head-on there, such as checking, but you can install your own implementation for your entities if you want it).

P
Puma Thailand, 2015-03-02
@opium

no, it doesn’t turn into sqllite
, you can use portable features
, the speed drops because the orm is not able to smoothly translate your complex queries into optimal ones for subds
+ many queries simply cannot be implemented in subds
+ you can’t use features specific only to this subd in the orm

D
DigitalSmile, 2015-03-02
@DigitalSmile

Like any code, an ORM carries logic. Executing this logic eats up memory and CPU time. Failure - no (always yours, KO).
The question is different - will you write the tasks for which you are going to use the ORM, also optimally, as written in the well-known ORMs? Maybe ORM is not needed in this case, and you can get by with direct communication with the DBMS driver (if you doubt the appropriateness of using it).
And here they correctly note that modern ORMs can be finely tuned, so if you have a large project, such libraries will help you a lot.

Y
Yuri, 2015-03-02
@riky

Does ORM slow you down?

the speed of the application may drop, but it also depends on how the code is written without the ORM.
no. development speed can greatly increase if you know how to work with it.
Personally, my opinion is that if the project is not initially highload, then it is better to use orm. development speed is greatly increased + the code becomes much easier to develop and refactor. fewer mistakes - more reliability, no headaches when you need to refactor something - the project develops easily. if the load increases - there are always many opportunities for optimization.
often if the load goes more to reading, then you need to cache + in bottlenecks, where you only need to show something, you can make direct queries to the database without orms. And orm to use only for change of objects.
a good orm does not bind hands but has the ability to do fine work at a lower level.
I've been using doctrine2 for php for a couple of years, even though I've been writing queries by hand for many years before. I don't want to go back, although I can.

A
Alexander Evseev, 2015-03-12
@alex1t

Of course it falls. But it all depends on the ORM.
If performance is important, then the best solution would be to use a microORM like Dapper or PetaPOCO. In fact, they only allow you to execute queries and quickly map objects. Dapper is good at this. The StackOverflow site is fully powered by it. But in this case, there are no "big" ORM goodies like state support and LINQ-to-SQL.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question