Posts

Using PostgreSQL as a cache?

In the article on his blog Peter asks " How much faster is Redis at storing a blob of JSON compared to PostgreSQL? ". Answer: 14x slower. Seems about right. Usually Redis is about 4x faster for a simple query like that compared to using PostgreSQL as a cache in my experience. It's why so many people use Redis as a cache. But I'd suggest PostgreSQL is good enough to act as a cache for many people. Django is pretty slow at fetching from PostgreSQL compared to other python options, so this could explain part of the 14x VS 4x difference. Note that Django should be adding an index because of ForeignKey. However it's possible it isn't being used, or the table may need to analyze stats again. Also note that Django does not support prepared statements built in, and when you don't use prepared statements you do not use the PostgreSQL query cache. Prepared statements can give a 50% speedup often, because they don't have to do the query parsing and do a n...

Experiments with new low latency PyPy garbage collector in a thread.

Image
TLDR; less performance spikes, faster average performance, PyPy is a good Python for games and multimedia apps on desktop systems, running GC in a thread is a good idea for GIL releasing apps. In March 2018 at the PyPy winter sprint I spent some days working on improving pygame support on PyPy. Part of this was investigating pypy frame drop . In there I found PyPy had both lower average performance in this pygame-using-CPython-API benchmark, and had spikes which caused frame drops. Remember that in latency sensitive applications performance spikes are not allowed. Note that not very much of this code is pure python (where PyPy is fastest), so it's almost a worst case benchmark for PyPy performance. Thanks to Antonio, the PyPy team and their supporters — things have much improved since then. One improvement in particular is that PyPy now allows more control of when the Garbage Collection does its work. Read more about it in the blog post " PyPy for low latency systems ...

Year of the Desktop #yearofthedesktop

Image
#yearofthedesktop is a long running joke in FLOSS communities. When will Linux be more popular than Windows on the Desktop? (please hold back your laughter until the end). Let me explain why this is the Year of the Desktop, and why community developed software will win (and in fact has already). TLDR; most PC hardware vendors are shipping Linux machines, Linux had the best cheap laptop of the year, Linux is a good platform for games, Steam now supports 1000s of Windows apps(+ 5000 linux native) and is contributing to Wine, the web is a good high quality desktop software target, government support for Linux desktop is increasing, and even Microsoft is supporting running Linux software on Windows, cheap hardware like Raspberry Pi(and more) is available and usable, community software cares about usability and has a supporting financial model, community development is a kinder place, fragmentation of the Desktop is no more, Gnome receives $1,000,000 donation, governments spe...

🐱‍🏍 — the first pygame 2 community game. Starting now! Are you in?

What is a 🐱‍🏍? *[0]. There was this email thread on the pygame mailing list. " About Pygame development ". One topic of that conversation was doing a community game in there for reasons(see below). I would like to do a pygame 2 community game to submit in the: - https://ldjam.com/ - https://itch.io/jam/game-off- 2018 (GameOff github jam) Ludumdare(ldjam) starts in 3 days, 7 hours. Theme not selected yet. GameOff finishes in 4 days 2 hours. Theme is "Hybrid ", Jam already started. So, the Jams finish in 4.1 days.   Are you in?  If so join the web based chatroom (discord) in the "#communitygame" channel. Our repo: https://github.com/pygame/stuntcat I'm trying to form a team now. ... read more?... click.... loading... loading... buffering... loading... refresh... loading... So why do this? My reasons for doing this are to push me to get pygame 2 features done that are actually u...

pygame 2 update - the examples all work

Image
  🎮👾👽🎮👾👽🎮👾👽🎮👾👽 examples/ chimp.py works 👽🎮👾👽🎮👾👽🎮👾👽🎮👾 That's a nice milestone for pygame 2 development. (and also, now these examples also work...     python -m pygame.examples.aliens     python -m pygame.examples.scroll ) I'm pretty sure all the examples are now working with SDL2/pygame 2. New SDL2 functionality. Also we have some new SDL2 functionality exposed     (experimentally, the APIs are not done yet). Multitouch, and AudioDevice, along with an example of recording audio. @dlon has been fixing a number of bugs(implementing key repeat, fixing unicode issues) and also prototyped some Window/Renderer classes (using ctypes and python). The new events are done in a backwards compatible way, so that games using them with pygame 1/SDL1 will still work. You just won't get the events. if event.type == pg.AUDIODEVICEADDED:     prin...

Drawing data. With #flask, and #matplotlib.

Image
Here's a pretty simple example of using the Flask microweb framework, and matplotlib together. Matplotlib is a graphing library used by a lot of people in python. But how to serve your graphs up in a web browser as a png or an SVG image? Code is in this gist: flask matplotlib . Serving svg and png images with Flask and matplotlib. here is what it looks like Code is in this gist: flask matplotlib .

Josh Bartlett — pygame Artist in Residence

Image
The pygame Artist in Residence grant celebrates the Python arts community and lends a tiny bit of support to someones art practice. Josh Bartlett was the first recipient. An artist residency usually works something like; a person spends some time in either a gallery making something to present or in a music club doing a weekly spot. The pygame artist in residence will do it in their own space, but be present on the top of the pygame website in the form of a thumbnail and a link to their patreon/blog/artist statement/website/whatever. Josh Bartlett was the first recipient, and has been featured on the pygame website in October.  Please see the pygame artist in residence profile page for more info. What has he been up to?  Go to his blog to find out. ps. Thank you to everyone who applied, and those who helped with selection. Hopefully the next one will go more smoothly as the process is improved.