isontheline / pro.webssh.net

iOS / iPadOS / macOS SSH Client
https://apps.apple.com/us/app/id497714887
MIT License
305 stars 44 forks source link

Performance Lag with Long Snippets in WebSSH #1144

Closed forsignup closed 2 months ago

forsignup commented 3 months ago

Bug description

I am experiencing some performance issues with WebSSH when working with long snippets, approximately 500 lines. These snippets are primarily used for echoing configuration to a file. The application becomes very slow and unresponsive, particularly when attempting to edit or save these long snippets. Additionally, even after saving and returning to the Snippets list, the application remains unresponsive for several seconds.

Environment

Software Version: 26.5 Operating System: macOS Sonoma 14.4

isontheline commented 3 months ago

@forsignup Thanks for your feedback!

Could you tell me which size (kb) are about 500 lines of your snippets? I would like to reproduce and fix as much as I can

forsignup commented 3 months ago

there is the code

cat > /usr/local/etc/sing-box/config.json <<EOF && \
sing-box restart
{
  "log": {
    "disabled": false,
    "level": "*****",
    "output": "/usr/local/sing-box/sing-box.log",
    "timestamp": true
  },
  "dns": {
    "servers": [
      {
        "tag": "*****",
        "address": "*****",
        "strategy": "*****",
        "detour": "*****"
      }
    ]
  },
  "inbounds": [
    {
      "type": "*****",
      "tag": "*****",
      "listen": "::",
      "listen_port": 12345,
      "sniff": true,
      "sniff_override_destination": true,
      "up_mbps": 1000,
      "down_mbps": 1000,
      "users": [
        {
          "name": "****************************************************************",
          "password": "****************************************************************",
        }
      ],
      "tls": {
        "enabled": true,
        "certificate": [
          "***************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "*************************",
          "*****"
        ],
        "key": [
          "*****",
         "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "****************************************************************",
          "*************************",
          "*****"
        ]
      },
      "masquerade": "*****"
    },
    {
      "type": "*****",
      "tag": "*****",
      "listen": "::",
      "listen_port": 12345,
      "method": "*****",
      "password": "*****",
      "sniff": true,
      "sniff_override_destination": true
    },
    {
      "type": "*****",
      "tag": "*****",
      "listen": "*****",
      "listen_port": 12345,
      "sniff": true,
      "sniff_override_destination": true
    },
    {
      "type": "*****",
      "tag": "*****",
      "listen": "*****",
      "listen_port": 12345,
      "users": [
        {
          "uuid": "*****",
          "alterId": 0
        }
      ],
      "transport": {
        "type": "*****",
        "path": "*****",
        "max_early_data": 12345,
        "early_data_header_name": "********************"
      },
      "sniff": true,
      "sniff_override_destination": true
    },
    {
      "type": "*****",
      "tag": "*****",
      "listen": "*****",
      "listen_port": 12345,
      "users": [
        {
          "uuid": "****************************************************************",
          "flow": "****************************************************************",
        }
      ],
      "tls": {
        "enabled": true,
        "server_name": "****************************************************************",
        "reality": {
          "enabled": true,
          "handshake": {
            "server": "****************************************************************",
            "server_port": 12345
          },
          "private_key": "****************************************************************",
          "short_id": [
            "*****",
            "****************************************************************"
          ]
        }
      },
      "sniff": true,
      "sniff_override_destination": true
    },
    {
      "type": "*****",
      "listen": "*****",
      "tag": "*****",
      "listen_port": 12345,
      "users": [
        {
          "uuid": "****************************************************************"
        }
      ],
      "tls": {
        "enabled": true,
        "server_name": "****************************************************************",
        "reality": {
          "enabled": true,
          "handshake": {
            "server": "****************************************************************",
            "server_port": 12345
          },
          "private_key": "****************************************************************",
          "short_id": [
            "*****",
            "****************************************************************"
          ]
        }
      },
      "transport": {
        "type": "*****",
        "service_name": "*****"
      },
      "sniff": true,
      "sniff_override_destination": true
    },
    {
      "type": "*****",
      "tag": "*****",
      "listen": "::",
      "listen_port": 12345,
      "users": [
        {
          "uuid": "*****",
          "flow": "*****"
        }
      ],
      "tls": {
        "enabled": true,
        "server_name": "*****",
        "reality": {
          "enabled": true,
          "handshake": {
            "server": "*****",
            "server_port": 12345
          },
          "private_key": "****************************************************************",
          "short_id": ["*****"]
        }
      },
      "multiplex": {
          "enabled": true,
          "padding": true,
          "brutal": {
              "enabled": true,
              "up_mbps": 1000,
              "down_mbps": 1000
          }
      },
      "sniff": true,
      "sniff_override_destination": true
    }
  ],
  "outbounds": [
    {
      "type": "*****",
      "tag": "*****"
    },
    {
      "type": "*****",
      "tag": "*****",
      "domain_strategy": "*****"
    },
    {
      "type": "*****",
      "tag": "*****",
      "bind_interface": "*****"
    },
    {
      "type": "*****",
      "tag": "*****"
    },
    {
      "type": "*****",
      "tag": "*****"
    },
    {
      "tag": "*****",
      "type": "*****",
      "server": "*****",
      "server_port": 12345,
      "version": "*****",
      "bind_interface": "*****"
    },
    {
      "tag": "*****",
      "type": "*****",
      "server": "*****",
      "server_port": 12345,
      "method": "*****",
      "password": "*****",
      "network": "*****",
      "tcp_fast_open": true
    },
    {
      "tag": "*****",
      "type": "*****",
      "server": "*****",
      "server_port": 12345,
      "method": "*****",
      "password": "*****",
      "network": "*****",
      "tcp_fast_open": true
    },
    {
      "tag": "*****",
      "type": "*****",
      "server": "*****",
      "server_port": 12345,
      "method": "*****",
      "password": "*****",
      "network": "*****",
      "tcp_fast_open": true
    },
    {
      "tag": "*****",
      "type": "*****",
      "server": "*****",
      "server_port": 12345,
      "method": "*****",
      "password": "*****",
      "network": "*****",
      "tcp_fast_open": true
    },
    {
      "type": "*****",
      "tag": "*****",
      "server": "*****",
      "server_port": 2408,
      "local_address": [
        "*****",
        "*****"
      ],
      "private_key": "*****",
      "peer_public_key": "*****",
      "reserved": "*****",
      "mtu": 1280
    },
    {
      "tag": "*****",
      "type": "*****",
      "server": "*****",
      "server_port": 12345,
      "password": "*****",
      "tls": {
        "enabled": true,
        "server_name": "*****",
        "insecure": true
      },
      "up_mbps": 1000,
      "down_mbps": 1000
    }
  ],
  "route": {
    "rules": [
      {
        "protocol": "*****",
        "outbound": "*****"
      },
      {
        "type": "*****",
        "mode": "*****",
        "rules": [
          { "inbound": [ "*****" ] },
          { "rule_set": [ "*****" ], "rule_set_ipcidr_match_source": true }
        ],
        "outbound": "*****"
      },
      {
        "ip_cidr": [ "*.*.*.*/24", "*.*.*.*/24", "*.*.*.*/24", "*.*.*.*/24", "*.*.*.*/24" ],
        "domain_keyword": [ "*****.com", "*****.com" ],
        "outbound": "*****-out"
      },
      {
        "rule_set": [ "*****", "*****" ],
        "ip_cidr": [ "*.*.*.*/24" ],
        "outbound": "*****"
      },
      {
        "rule_set": [ "*****" ],
        "ip_is_private": true,
        "outbound": "*****"
      },
      {
        "rule_set": [ "*****" ],
        "outbound": "*****"
      },
      {
        "rule_set": [ "*****" ],
        "outbound": "*****"
      },
      {
        "rule_set": [ "*****-ip", "*****-site" ],
        "outbound": "*****"
      },
      {
        "rule_set": [ "*****-ip", "*****-site" ],
        "outbound": "*****"
      },
      {
        "rule_set": [ "*****-ip", "*****-site" ],
        "outbound": "*****"
      },
      {
        "domain_suffix": "*****.cn",
        "outbound": "*****"
      }
    ],
    "final": "*****",
    "auto_detect_interface": true,
    "rule_set": [
      {
        "tag": "*****", "type": "*****", "format": "*****", "download_detour": "*****",
        "url": "https://**************************************************************"
      },
      {
        "tag": "*****", "type": "*****", "format": "*****", "download_detour": "*****",
        "url": "https://**************************************************************"
      },
      {
        "tag": "*****", "type": "*****", "format": "*****", "download_detour": "*****",
        "url": "https://**************************************************************"
      },
      {
        "tag": "*****", "type": "*****", "format": "*****", "download_detour": "*****",
        "url": "https://**************************************************************"
      },
      {
        "tag": "*****", "type": "*****", "format": "*****", "download_detour": "*****",
        "url": "https://**************************************************************"
      },
      {
        "tag": "*****", "type": "*****", "format": "*****", "download_detour": "*****",
        "url": "https://**************************************************************"
      },
      {
        "tag": "*****", "type": "*****", "format": "*****", "download_detour": "*****",
        "url": "https://**************************************************************"
      },
      {
        "tag": "*****", "type": "*****", "format": "*****", "download_detour": "*****",
        "url": "https://**************************************************************"
      },
      {
        "tag": "*****", "type": "*****", "format": "*****", "download_detour": "*****",
        "url": "https://**************************************************************"
      },
      {
        "tag": "*****", "type": "*****", "format": "*****", "download_detour": "*****",
        "url": "https://**************************************************************"
      },
      {
        "tag": "*****", "type": "*****", "format": "*****", "download_detour": "*****",
        "url": "https://**************************************************************"
      },
    ]
  },
  "experimental": {
    "cache_file": {
      "enabled": true
    }
  }
}
EOF
isontheline commented 3 months ago

Thank you @forsignup 👍

I will start working on this soon (just after https://github.com/isontheline/pro.webssh.net/issues/60)

isontheline commented 2 months ago

Hello @forsignup 👋

OK I can reproduce when I want to edit the snippet content itself.

I'm searching for the root cause. Will ping you when done.

isontheline commented 2 months ago

Hello @forsignup 👋

Could you give a try to the latest beta release please? https://testflight.apple.com/join/QSrBK59z

forsignup commented 2 months ago

Works fine now!

isontheline commented 2 months ago

Thanks for your feedback @forsignup 🙏