File access in mounted volumes extremely slow, CPU bound

I gnashed my teeth for about 24 hours on this problem before coming to a simple solution for my case: simply don’t sync when not necessary. I’m sure this doesn’t work for everyone – but in case your issue is analogous:

I set up a development environment including traefik, ember-cli and some data services. Ember-cli has the package directory mounted and uses ember serve to serve. It takes 8-10 times longer set up this way. However, mounting the ./tmp and ./dist subdirectories as tmpfs volumes gives me almost all the time back.

services:
  web:
    build: "$PWD/services/crane-wisdom"
    image: "cws/wisdom"
    volumes:
      - $PWD/services/crane-wisdom/crane-wisdom:/home/docker/app
      - $PWD/services/crane-wisdom/crane-wisdom/docker_node_modules:/home/docker/app/node_modules
      - web_temp:/home/docker/app/tmp
      - web_dist:/home/docker/app/dist
    links:
      - server
    command: [
      "ember", "serve", "--proxy", "http://server:16006",
      "-lr", "false" ]
    depends_on:
      - server
    labels:
      - traefik.port=4200
      - traefik.frontend.rule=Host:localhost

# create temporary volumes for ember-cli compile to avoid
# slow sync back to host
volumes:
  web_temp:
    driver_opts:
      type: tmpfs
      device: tmpfs
  web_dist:
    driver_opts:
      type: tmpfs
      device: tmpfs