Haki

@be_haki

A software developer and a technical lead. I take special interest in databases, web development, software design and performance tuning.

Vrijeme pridruživanja: rujan 2014.

Tweetovi

Blokirali ste korisnika/cu @be_haki

Jeste li sigurni da želite vidjeti te tweetove? Time nećete deblokirati korisnika/cu @be_haki

  1. proslijedio/la je Tweet
    27. sij
    Odgovor korisniku/ci

    Correct (and others) who guessed it! The offending object was an inline RegEx! After moving its declaration to get compiled once... Bam! A 1,000x performance change! I'd have guessed it would be 5-10x slower - not *that* much slower.

    Before: regex literal re-created each time function is called!
    After: moved regex instantiation to trigger only once, great success!
    Poništi
  2. 30. sij

    🐍 🗺️ A quick tip: generating translations using makemessages can create huge git diffs that are tricky to merge. One way to reduce the amount of diffs is to turn off the file location using the --no-location option 👍 👍 👍

    Poništi
  3. 27. sij

    🐍 💡 TIL: To provide initial values for a multiple choice field in a Django form, you can't just use request.GET... you have to use a little trick 🤔

    A little trick to set multuple initial value in a Django form
    Poništi
  4. proslijedio/la je Tweet
    26. sij

    1) Are you using via for mac? Have you ever noticed `EXPLAIN ANALYZE` slowing down your queries by like 60x? Let's dig into some and internals to figure out what's going on!

    An accessible version of this thread is available at https://github.com/felixge/tweets/tree/master/postgres-docker-explain-analyze
    Prikaži ovu nit
    Poništi
  5. 23. sij

    💡 🐍 Following my previous tweet... Use Sequence instead of List for immutable lists.

    Use Sequence instead of List for immutable lists
    Poništi
  6. 22. sij
    Use Mapping instead of Dict for immutable dictionaries
    Poništi
  7. 21. sij

    🐍 TIL: `msguniq` is a utility program that eliminates duplicate translations in po files. Just saved myself a major headache merging an old branch 🤩

    Poništi
  8. 20. sij

    FYI, assert_never can also be implemented in

    Prikaži ovu nit
    Poništi
  9. 20. sij

    🐍 The missing part from : exhaustiveness checking for union types. Add `assert_never` to your code and be forever grateful... 😇 🙏

    Exhaustiveness checking for union types in python using mypy
    Prikaži ovu nit
    Poništi
  10. 17. sij

    💡 🐍 🐘 You can get the query text in using queryset.query. But, if the queryset contains parameters the text is usually not valid SQL. Using psycopg mogrify, you can get the interpolated query. Very useful for debugging SQL issues.

    Poništi
  11. 16. sij

    🐍 🐘 🛡️ In you can bind identifiers such as table and column names safely, and avoid Injections in using psycopg2. Keep in mind the next time you use string interpolation to generate SQL...

    Poništi
  12. proslijedio/la je Tweet
    15. sij
    Poništi
  13. 15. sij

    🐍 Here is A magical context processor to temporarily set model instance attributes. Saved us dozens of test fixture variations... works very nice with

    Demonstrate how to create and use a context processor that temporarily sets Django instance attribute
    Poništi
  14. 14. sij

    🐍 Did you know you can provide your own query to prefetch related using the Prefetch object? You can even add select_related to the prefetched query. Very useful for speeding up processing across M2M relations. More here:

    Using the Prefetch object to customize prefetch_related in Django
    Poništi
  15. 13. sij

    Here's a little ORM gotacha: using select_for_update will lock *all the tables* in the query. To lock specific tables use select_for_update(of=(...)).

    Demonstrating use of select_for_update
    Poništi
  16. 9. sij

    🐍 How to add a calculated percent field to a QuerySet? Not so simple... This is why

    Poništi
  17. 7. sij

    Attaching the reference to where prefetching is mentioned. However, prefetching large files into memory is not ideal. Tried to experiment with different buffer sized, no effect.

    Prikaži ovu nit
    Poništi
  18. 7. sij

    🐍 Paramiko, a client, is apparently very slow out of the box: 27MB in 1:30 minutes. With prefetching the same file downloads in only 7s 🚀 What is the right way to speed download with Paramiko?

    Prikaži ovu nit
    Poništi
  19. proslijedio/la je Tweet
    2. sij

    Remember that you can use a ~/.gitignore_global file to include all your dev tools-related git exclusions, instead of annoyingly doing it per project.

    Poništi
  20. proslijedio/la je Tweet
    4. sij

    🐍📰 How to Create an Index in Django Without Downtime In this step-by-step Python tutorial, you'll get a solid understanding of the limitations of Django migrations by tackling a well known problem: creating an index in Django with no downtime

    Poništi

Čini se da učitavanje traje već neko vrijeme.

Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.

    Možda bi vam se svidjelo i ovo:

    ·