Earlier quoted context omitted.
Go being low-level has nothing to do with performance. They deliberately keep feature set on this level, they're not making some kind of trade-off. Also, high performance C# is so low level that you might as well write C++. Or you think you will use EF, LINQ and have 7 millions rps?
> Or you think you will use EF, LINQ and have 7 millions rps? I'm imagining not, but it's still comparatively faster than most, if not all, "full-batteries frameworks", right? I'm assuming the use of ORMs and such is more or less uniform in the comparison (eg, if they don't use EF for .net, they don't use Django ORM either) The overall performance of .net across these benchmarks really catches my attention like it do…
12 requests per second: A realistic look at Python web frameworks
231–239 of 239 posts
Re: 12 requests per second: A realistic look at Python web frameworks
#232Getting an API hit from 300ms to 70ms, and proper frontend caching is far more valuable than concurrency (if you can afford to throw servers at it) because it actually affects user performance.
Re: 12 requests per second: A realistic look at Python web frameworks
#233Earlier quoted context omitted.
I always though it would be a nice alternative to an ORM: having a tool that take a marshmallow/pydantic/whatever model, optionally passing it additional db specific options, then it generates a bunch of sql files you can call with aiosql. The whole things would then let you optionally get the result wrapped in a model if you need to, with ORM like helpers for common CRUD things. That would have the benefit of the st…
Absolutely! I think it should be doable, FastAPI and other libraries do heavy Pydantic model inspection, and some do automatic code generation. I should explore this a bit more.
- because you have all your queries written in the same place, when you create a db migration, you know where to look for code to update, and can even perform some automatically.
- sql queries could be turned into a stored procedure with a simple marking, without changing any code.
Of course the downside is that dynamically exploring data is not as easy as with an ORM.
Re: 12 requests per second: A realistic look at Python web frameworks
#234Earlier quoted context omitted.
I have never seen anyone, even the ORM "experts" in my jobs, save time with an ORM over what a junior engineer couldn't do faster with plain SQL. The reason is that sure, for your first 10 basic select queries, the ORM saved you half an hour. Then you got to that complicated join and had to resort to looking up archane syntaxes and prototyping attribute quirks for an hour, when the junior guy got the whole thing writ…
> The reason is that sure, for your first 10 basic select queries, the ORM saved you half an hour Maybe we work in very different fields, but "basic select queries" makes up 90% of what I need to fetch from the database. If I'm working on a forum and I want to load user 123, with all their posts, all the awards each post has, and the count of friends the user has, with Eloquent (Laravel's ORM), I could do: `User::wit…
But the thing is, a lot of things aren't really on the hot path and optimizing them isn't worth a ton of time. Like yeah so what if this web request that only gets used 2% of the time makes 5 extra database requests that it shouldn't, on a single data item. Not gonna tank the overall program.
I guess I'd accept that it's important to be aware of what you're pulling, regardless of whether that's automagically when a proxy object sees it needs to be lazy loaded, or explicitly in a query. Throwing junior developers on performance-critical paths is going to be a problem anywhere and on any DB access layer.
Re: 12 requests per second: A realistic look at Python web frameworks
#235Earlier quoted context omitted.
for me the value of an ORM is not so much query synthesis as serialisation of object fields to db columns and vice versa
Same here. I'd love to have a tool that just generates an object type for a given SQL query's result rows, and a function signature for its query parameters.
Re: 12 requests per second: A realistic look at Python web frameworks
#236Earlier quoted context omitted.
IIRC spark can optimize it away, and in OO there shouldn't be user_id
> in OO there shouldn't be user_id I don't think that's right. There is a user_id column in the book table, so why shouldn't there be book.user_id?
hibernate is then "the magic "environment where it just works"
I realize OO is out of fashion now but it's still true and it still works and I've been in a lots of projects where ORM was useful
Re: 12 requests per second: A realistic look at Python web frameworks
#237Earlier quoted context omitted.
Same here. I'd love to have a tool that just generates an object type for a given SQL query's result rows, and a function signature for its query parameters.
sqlc can do this: https://sqlc.dev/
Re: 12 requests per second: A realistic look at Python web frameworks
#238Earlier quoted context omitted.
Same here. I'd love to have a tool that just generates an object type for a given SQL query's result rows, and a function signature for its query parameters.
Just hack that for Typescript over this weekend (: https://news.ycombinator.com/item?id=26211286
If you want to keep going forward with it, I'd recommend working on making it clearer what the examples do, and looking at sqlc for Go for inspiration. Of the existing versions of this people replied with, that one had the clearest API, or at least clearest explanation on its landing page.
Re: 12 requests per second: A realistic look at Python web frameworks
#239My 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's expensive). Sure,…
I increasingly lean towards plain SQL over ORMs. It requires greater familiarity with SQL but I prefer that over greater familiarity with ORM-specific syntax that doesn’t translate across frameworks or languages. In addition, you can prototype new queries and profile existing queries in the database and copy-paste directly into your code.