<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>stevenjohns</author><text>There is lots of truth to this. Some ORMs like Django perform joins in very unsuspecting ways.&lt;p&gt;A simple example is, say, foreign keys. Trying to access the foreign key of an object by doing `book.user.id` does an additional query for the user table to get the ID. It&amp;#x27;s less known that the id is immediately available by just doing `book.user_id` instead.&lt;p&gt;I&amp;#x27;ve spent time optimising things like text searches down from 2000+ queries to about ~4, and one of the more noticeable things to me isn&amp;#x27;t actually the number of joins, rather the SELECT&amp;#x27;s that take place. Many of these ORMs do a SELECT * unless you explicitly tell them to otherwise, and when dealing with large-ish datasets or on models that have large text fields this translates into significant time taken to &lt;i&gt;serialise&lt;/i&gt; these attributes. So you can optimise the query and still have it take a long time until you realise that limiting the initial `SELECT` parameter is probably more efficient than limiting the number of joins.</text><parent_chain><item><author>imperio59</author><text>My experience doing perf optimizations in real world systems with many many people writing code to the same app is a lot of inefficiencies happen due to over fetching data, inefficiencies caused by naively using the ORM without understanding the underlying cost of the query, and lack of actual profiling to find where the actual bottlenecks are (usually people writing dumb code without realizing it&amp;#x27;s expensive).&lt;p&gt;Sure, the framework matters at very large scale and the benefits from optimizing the framework become large when you&amp;#x27;re doing millions of requests a second over many thousands of servers because it can help reduce baseline cost of running the service.&lt;p&gt;But I agree with the author&amp;#x27;s main point which seems to be that framework performance is pretty meaningless when comparing frameworks if you&amp;#x27;re just starting on a new project. Focus on making a product people wanna actually use first. If you&amp;#x27;re lucky enough to get to scale you can work about optimizing it then.</text></item></parent_chain></comment><story><title>12 requests per second: A realistic look at Python web frameworks</title><url>https://suade.org/dev/12-requests-per-second-with-python/</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>Izkata</author><text>&amp;gt; (usually people writing dumb code without realizing it&amp;#x27;s expensive)&lt;p&gt;Some years ago, one morning I gave a co-worker a recommendation on how to improve a loop that was unnecessarily hitting database through the Django ORM.  He committed the fix that afternoon.  Barely an hour later I accidentally reintroduced the exact same slowdown in the exact same loop when adding a different piece of data to it.&lt;p&gt;Soooo yeah, ORMs can be so simplistic it&amp;#x27;s too easy to do by accident even if you know exactly what&amp;#x27;s going on under the hood.</text><parent_chain><item><author>imperio59</author><text>My experience doing perf optimizations in real world systems with many many people writing code to the same app is a lot of inefficiencies happen due to over fetching data, inefficiencies caused by naively using the ORM without understanding the underlying cost of the query, and lack of actual profiling to find where the actual bottlenecks are (usually people writing dumb code without realizing it&amp;#x27;s expensive).&lt;p&gt;Sure, the framework matters at very large scale and the benefits from optimizing the framework become large when you&amp;#x27;re doing millions of requests a second over many thousands of servers because it can help reduce baseline cost of running the service.&lt;p&gt;But I agree with the author&amp;#x27;s main point which seems to be that framework performance is pretty meaningless when comparing frameworks if you&amp;#x27;re just starting on a new project. Focus on making a product people wanna actually use first. If you&amp;#x27;re lucky enough to get to scale you can work about optimizing it then.</text></item></parent_chain></comment><story><title>12 requests per second: A realistic look at Python web frameworks</title><url>https://suade.org/dev/12-requests-per-second-with-python/</url></story>