Properly setting a Content Security Policy is the toughest problem in computer science.
Posts
-
Properly setting a Content Security Policy is the toughest problem in computer science. -
I wish we could use the same naming conventions across the stack, but snake_case looks odd in JavaScript, CamelCase feels off in Python, and kebab-case is wrong everywhere except in CSS.@mahryekuh oh, I didn't thought about that. The screen readers pronounce all the underscores/dashes, don't they?
-
I wish we could use the same naming conventions across the stack, but snake_case looks odd in JavaScript, CamelCase feels off in Python, and kebab-case is wrong everywhere except in CSS.I wish we could use the same naming conventions across the stack, but snake_case looks odd in JavaScript, CamelCase feels off in Python, and kebab-case is wrong everywhere except in CSS.
I liked the other two points of the post. Worth a read!
Greppability is an underrated code metric
Keeping your codebase searchable will make your maintenance life easier in the long run
(morizbuesing.com)
-
No wonder everyone's asking @hynek to make more videos. YouTube is the second most popular place to learn about Python according to the Python Developers Survey 2023!No wonder everyone's asking @hynek to make more videos. YouTube is the second most popular place to learn about Python according to the Python Developers Survey 2023!
It's even higher than Python org!
-
First time that I see template rendering being a bit of a bottle neck in a Django app.@carlton @hruske I think I found the culprit for this.
`django-debug-toolbar-template-profiler` adds some overhead on every template include. So the differences that I've been seeing between inline and include was due to this overhead.
If I have template profiling enabled the include version is 2x slower (700ms vs 1.4s), if I disable profiling they are both almost the same (10ms give or take)
Annoying when the tool you are using to measure impacts the measurement
-
First time that I see template rendering being a bit of a bottle neck in a Django app.@carlton @hruske I'm circling back to this post because I now have data from production. There was *no* performance increase due to me inlining the template import inside the for loop.
The perf boost that I was seeing locally was only due to the fact that I had DEBUG=True which prevented the use of the cached template loader. I apologize for the confusion!
-
First time that I see template rendering being a bit of a bottle neck in a Django app.@carlton @hruske Hm... l managed to shave of 100ms of rendering time by inlining an inclusion tag, that I was using inside a for loop.
I'll report back if this change also translates in a similar improvement in prod where the cached template loader is used.
The commit diff is here if you are curious: https://github.com/anze3db/fedidevs/commit/7bf9870d8ab42924ea4b23a292af3ecf0177dc9b
-
First time that I see template rendering being a bit of a bottle neck in a Django app.@carlton yeah, could be, but I'm now digging into this and it looks like template rendering is taking the longest even in some faster requests. I'll see if I can figure out what could be causing this.
-
First time that I see template rendering being a bit of a bottle neck in a Django app.@carlton the SD card issue was my own blunder. I am using an SD card that can only read up to 4mb/, but I could have easily gotten one that goes up to 100mb/s
Also, this was the only trace that I have out of 100k requests from yesterday that was over 400ms long.
-
First time that I see template rendering being a bit of a bottle neck in a Django app.@carlton the SD card that I'm using is too slow for this disk caching to be viable
-
First time that I see template rendering being a bit of a bottle neck in a Django app.@carlton There is one 2.7ms db query that gets run during template rendering. The other three queries are run before the rendering starts and are also below 200ms, so I'm pretty sure the template rendering took the longest at around 500ms.
The raspberry pi doesn't have the fastest CPU so this might not be an issue on a regular host.
-
First time that I see template rendering being a bit of a bottle neck in a Django app.First time that I see template rendering being a bit of a bottle neck in a Django app.
This was on a Raspberry Pi 4 while all 4 cores were over 80%.