* All my Python solutions were under 1s using pure Python and 100ms with a little help from mypy/scipy
• The AoC community is the best ❤️
blog.pecar.me/advent-of-c...
* All my Python solutions were under 1s using pure Python and 100ms with a little help from mypy/scipy
• The AoC community is the best ❤️
blog.pecar.me/advent-of-c...
All but two are under 10ms. Not bad for the slowest popular language out there 🐍, although I did have to use numpy a few times.
All but two are under 10ms. Not bad for the slowest popular language out there 🐍, although I did have to use numpy a few times.
1. Slower solutions are no longer counted in totals
2. Slower solutions are dimmed out
Why limit yourself to one #adventofcode solution per day? 😆
Happy solving! 🎄
1. Slower solutions are no longer counted in totals
2. Slower solutions are dimmed out
Why limit yourself to one #adventofcode solution per day? 😆
Happy solving! 🎄
* Rows with a red background are on 8x Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz.
* Rows with a green background are on Apple M3 Max.
So if you want to be better at advent of code just get a better CPU? 😆
* Rows with a red background are on 8x Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz.
* Rows with a green background are on Apple M3 Max.
So if you want to be better at advent of code just get a better CPU? 😆
Today I learned that you can use None when slicing a list in Python:
>>> [1,2,3][:None]
[1, 2, 3]
Useful to avoid the edge case where [:0] would give an empty list:
>>> [1,2,3][:0]
[]
Today I learned that you can use None when slicing a list in Python:
>>> [1,2,3][:None]
[1, 2, 3]
Useful to avoid the edge case where [:0] would give an empty list:
>>> [1,2,3][:0]
[]
25.4 adds a `adventofcode run` command that removes the ugly boilerplate that you had to have in your puzzle files until now!
Before: After:
25.4 adds a `adventofcode run` command that removes the ugly boilerplate that you had to have in your puzzle files until now!
Before: After:
I got to the solution fairly quickly but it was a bit slow. I then spent the next hour optimizing it and managed to make part 1 200x faster and part 2 500x faster 🎉
I got to the solution fairly quickly but it was a bit slow. I then spent the next hour optimizing it and managed to make part 1 200x faster and part 2 500x faster 🎉
My code took 1.1ms for both parts without any perf optimizations 🎉
Eleven more to go!
My code took 1.1ms for both parts without any perf optimizations 🎉
Eleven more to go!
I've added a command line tool that helps you scaffold all the files for puzzle days because I got annoyed by copy pasting the same file each time!
pypi.org/project/adv...
I've added a command line tool that helps you scaffold all the files for puzzle days because I got annoyed by copy pasting the same file each time!
pypi.org/project/adv...
Python is getting lazy imports!
So excited about this!
discuss.python.org/t/pep-810-ex...
Python is getting lazy imports!
So excited about this!
discuss.python.org/t/pep-810-ex...
Congratulations to @lukasz.langa.pl on a wonderful run as release manager! 🖤
discuss.python.org/t/the-final-...
Congratulations to @lukasz.langa.pl on a wonderful run as release manager! 🖤
discuss.python.org/t/the-final-...
The x.2 LTS releases always felt wrong to me since it has always been much easier and safer to upgrade each version rather than doing the LTS to LTS leap in one go.
buttondown.com/carlton/arc...
The x.2 LTS releases always felt wrong to me since it has always been much easier and safer to upgrade each version rather than doing the LTS to LTS leap in one go.
buttondown.com/carlton/arc...
Be cautious with your memory usage.
blog.pecar.me/django-bulk-...
#django #python
Be cautious with your memory usage.
blog.pecar.me/django-bulk-...
#django #python
🧵
🧵
🧵
The TLDR version is that bulk_update prepares all the update statements in advance (even when batch_size is set) which can use more memory than expected.
Details and a solution in the blog:
blog.pecar.me/django-bulk...
The TLDR version is that bulk_update prepares all the update statements in advance (even when batch_size is set) which can use more memory than expected.
Details and a solution in the blog:
blog.pecar.me/django-bulk...
The trick was to stop dynamically computing the number of accounts in a starter pack and instead precompute it in a column.
A bit more work on each update, but worth it!
The trick was to stop dynamically computing the number of accounts in a starter pack and instead precompute it in a column.
A bit more work on each update, but worth it!
The upgrade didn't require any code changes on my part, but I did see a few return statements in the finally block SyntaxWarnings in a few dependencies.
The upgrade didn't require any code changes on my part, but I did see a few return statements in the finally block SyntaxWarnings in a few dependencies.
✨ Template strings (t-strings) for safer string interpolation
🚀 Free-threaded Python officially supported (bye GIL!)
🎨 Syntax highlighting in the REPL
📦 Zstandard compression in stdlib
🔍 Remote PDB debugging
Full release notes: docs.python.org/3.14/whatsne...
✨ Template strings (t-strings) for safer string interpolation
🚀 Free-threaded Python officially supported (bye GIL!)
🎨 Syntax highlighting in the REPL
📦 Zstandard compression in stdlib
🔍 Remote PDB debugging
Full release notes: docs.python.org/3.14/whatsne...
discuss.python.org/t/pep-810-ex...
#Python #PEP