www.eamoncaddigan.net

Content and configuration for https://www.eamoncaddigan.net
git clone https://git.eamoncaddigan.net/www.eamoncaddigan.net.git
Log | Files | Refs | Submodules | README

index.md (2324B)


      1 ---
      2 title: "Weeknote for 2025-W13"
      3 description: ""
      4 date: 2025-03-24T08:59:00-07:00
      5 draft: false
      6 categories:
      7 - Weeknotes
      8 tags:
      9 - Python
     10 - R
     11 ---
     12 
     13 ## Multiprocessing in Python is pretty broken
     14 
     15 A common scenario: you have some code Python that's taking too long. But the
     16 algorithm is embarrassingly parallel and your computer has all these cores, so
     17 maybe you can speed it up by using them all. So you spend a day refactoring
     18 things to use `multiprocessing`, and... it doesn't help at all.
     19 Congratulations, you just got bitten by the
     20 [GIL](https://wiki.python.org/moin/GlobalInterpreterLock). This post ([H/T
     21 Brandon Rohrer](https://recsys.social/@brohrer/114180565217926164)) goes into
     22 the issue and talks about some workarounds.
     23 
     24 [Itamar Turner-Trauring --- Python’s multiprocessing performance
     25 problem](https://pythonspeed.com/articles/faster-multiprocessing-pickle/)
     26 
     27 ## A bookmarklet to download web fonts
     28 
     29 Whenever you see a cool typeface on the web, that usually because the site has
     30 sent a whole a web font to your browser. What if you wanted to keep that file
     31 for... other uses? This bookmarklet helps you do just that.
     32 
     33 [Immoral Web Font Vacuum](https://smallandnearlysilent.com/immoral/)
     34 
     35 ## Suppressing lintr false positives when using targets
     36 
     37 I'm [still experimenting with LazyVim]({{< ref
     38 "posts/weeknotes/2025-w10/#trying-lazyvim" >}}), and among its other slick
     39 features, I get suggestions from [lintr](https://lintr.r-lib.org/) right in my
     40 editor window as I write R code. I'm a big fan of the
     41 [targets](https://books.ropensci.org/targets/) workflow, but using lintr with
     42 scripts that will be run from targets generates false-positive lints, citing
     43 "no visible global function definition" for the functions that are imported
     44 from other packages. This happens because the functions are run in an
     45 environment with all the appropriate packages attached, but the scripts
     46 themselves don't load them with a call to `library()`. It would be ideal to be
     47 able to suppress this specific check when writing targets code, but for now I'm
     48 suppressing the error with a `.lintr` file in the root of each project that
     49 contains only the following:
     50 
     51 ```r
     52 linters: linters_with_defaults(
     53     object_usage_linter = NULL
     54   )
     55 ```
     56 
     57 This didn't feel worthy of a whole blog post, but I wanted to share this
     58 workaround more broadly!