Repository: stable-diffusion-webui
Issue: [Bug]: Web UI slows down generation in img2img (Firefox only?)
Labels: bug-report

### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

When running generations on the img2img tab, performance becomes very slow, much slower than txt2img for similarly sized images -- *unless* I change tabs (in my browser) so that img2img and automatic1111 is no longer in focus. Then generation performs at normal expected rate. 

Seems to happen in Firefox, but not Chrome.

Browser: Firefox
OS: Windows
Python: 3.10

### Steps to reproduce the problem

1. Go to img2img
2. Upload an image
3. Click Generate
4. Wait (a long time)

Steps to *Avoid* the Problem
1. Go to img2img
2. Upload an image
3. Glick Generate
4. Change to any other tab in Firefox so that Automatic1111 is not shown
5. Wait (a few seconds)

OR



### What should have happened?

1. Go to img2img
2. Upload an image
3. Click Generate
4. Wait (a few seconds)

### Version or Commit where the problem happens

1.4.0

### What Python version are you running on ?

Python 3.10.x

### What platforms do you use to access the UI ?

Windows

### What device are you running WebUI on?

Nvidia GPUs (GTX 16 below)

### Cross attention optimization

Automatic

### What browsers do you use to access the UI ?

Mozilla Firefox

### Command Line Arguments

```Shell
N/A
```


### List of extensions

No

### Console logs

```Shell
Installing requirements


#######################################################################################################
Initializing Dreambooth
If submitting an issue on github, please provide the below text for debugging purposes:

Python revision: 3.10.7 (tags/v3.10.7:6cc6b13, Sep  5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)]
Dreambooth revision: 9f4d931a319056c537d24669cb950d146d1537b0
SD-WebUI revision: 394ffa7b0a7fff3ec484bcd084e673a8b301ccc8

Checking Dreambooth requirements...
[+] bitsandbytes version 0.35.0 installed.
[+] diffusers version 0.10.2 installed.
[+] transformers version 4.25.1 installed.
[ ] xformers version N/A installed.
[+] torch version 2.0.1+cu118 installed.
[+] torchvision version 0.15.2+cu118 installed.

#######################################################################################################


Launching Web UI with arguments: --reinstall-torch
No module 'xformers'. Proceeding without it.
SD-Webui API layer loaded

---
Loading weights [52484e6845] from C:\Users\lobot\scratch\stable-diffusion-webui\models\Stable-diffusion\epicrealism_pureEvolutionV3.safetensors
Creating model from config: C:\Users\lobot\scratch\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying attention optimization: Doggettx... done.
Model loaded in 22.0s (load weights from disk: 15.5s, load config: 0.1s, create model: 3.7s, apply weights to model: 0.8s, apply half(): 0.8s, move model to device: 0.9s).

---
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 46.2s (import torch: 7.8s, import gradio: 1.1s, import ldm: 0.7s, other imports: 2.2s, setup codeformer: 0.1s, list SD models: 0.3s, load scripts: 3.1s, create ui: 30.5s, gradio launch: 0.2s).
preload_extensions_git_metadata for 16 extensions took 4.61s
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [01:06<00:00,  4.45s/it]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 15/15 [00:49<00:00,  3.31s/it]
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [00:46<00:00,  3.11s/it]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 15/15 [00:45<00:00,  3.01s/it]
 13%|███████████                                                                        | 2/15 [02:13<16:57, 78.29s/it]
Total progress:  13%|████████▉                                                          | 2/15 [02:10<14:11, 65.49s/it]
```


### Additional information

_No response_