title: RStudio graphics device really slow for spatial objects on mac
body: <p>I recently got a new macbook pro and am having some R graphics related problems on it. R is working insanely slowly when plotting sf objects. I found a thread that's a couple of years old on this issue (here: <a href="https://github.com/rstudio/rstudio/issues/3866" rel="nofollow noreferrer">https://github.com/rstudio/rstudio/issues/3866</a>), but no solution was ever proposed. For reference, <code>RStudioGD</code> is plotting the object &gt;300x more slowly than <code>pdf</code> and it's making me crazy. Sharing the reproducible example from the link above here (though the system time numbers are mine):</p>
  <p>&lt;&lt;================= copy from link above: ===========================&gt;&gt;</p>
  <p>I wanted to plot the shapefile for Myanmar found here:</p>
  <p><a href="https://gadm.org/download_country_v3.html" rel="nofollow noreferrer">https://gadm.org/download_country_v3.html</a></p>
  <pre><code>library(rgdal)
  library(sp)
  tdir = tempdir()
  
  get_poly = function() {
    tmp = tempfile(tmpdir = tdir)
    download.file(
      'https://biogeo.ucdavis.edu/data/gadm3.6/shp/gadm36_MMR_shp.zip',
      tmp
    )
    
    unzip(tmp, exdir = tdir)
    
    readOGR(tdir, 'gadm36_MMR_0', stringsAsFactors = FALSE)
  }
  </code></pre>
  <p>Plotting this with RStudioGD is much, much slower than to e.g. pdf:</p>
  <pre><code>mmr = get_poly()
  system.time(plot(mmr))
  #    user  system elapsed 
  # 128.162   0.510 129.271 
  unlink(tdir, recursive = TRUE)
  </code></pre>
  <p>Restart R to clear cache/overhead and run again:</p>
  <pre><code>mmr = get_poly()
  tpdf = tempfile(tmpdir = tdir, fileext = 'pdf')
  system.time({
    pdf(tpdf)
    plot(mmr)
    dev.off()
  })
  #    user  system elapsed 
  # 0.423   0.027   0.460 
  unlink(tdir, recursive = TRUE)
  </code></pre>
  <p>So using the external device is about 300x faster... any idea?</p>
  <p>png also takes &lt; 1 second</p>
  <p>&lt;&lt;=================== end copy from link =======================&gt;&gt;</p>
  <p>I am on macOS Big Sur 11.1
  RStudio version 1.3.1093</p>
  <p>(I am having some other vague graphics-related problems that I posted about here: <a href="https://stackoverflow.com/questions/65522587/quartz-device-behaving-strangely-after-mac-update-r-mac">quartz device behaving strangely after mac update - R mac</a>, but I am not sure if the two are related or not).</p>