# sing-box vs xray An attempt on benchmarking these two multi-protocol proxying frameworks. It's reproducible, configs are not redacted, I even uploaded self-signed TLS cert+key, client commands are shown in `bench_*.txt` files. All you need is iperf3 on client and server, hyperfine on client, xray and sing-box binaries (take from "Releases" or compile by yourself) placed on client and server. ## In a nutshell Results are inaccurate, they look like a statistical error, made by, for example, different ISP's network load, that's why I said "an attempt on benchmarking". Both proxies are almost the same speed. *Xray was sometimes a bit faster.* But in iperf3 benchmark it often behaved weird: from 2nd packet speed was dropping to zero. So, use what you want / to what you already get used / what works better in your case. As for me, I found sing-box' JSON config more convenient than Xray's. On the other hand, Xray provides more features to hide a proxy, that is important, I guess (?), in China and Iran. ## Version sing-box built from dev-next branch, [26f092d](https://github.com/SagerNet/sing-box/commit/26f092da6fb0801b11c91fd5c8468e9949312e02) ``` sing-box version unknown Environment: go1.23.2 linux/amd64 Tags: with_gvisor,with_dhcp,with_wireguard,with_reality_server,with_clash_api,with_quic,with_utls,with_ech Revision: d97a7569507816bf2ac1a355e19d26b521fb046e CGO: enabled ``` Xray-core built from main branch, [5a96ef6](https://github.com/XTLS/Xray-core/commit/5a96ef632d65b8e68c4f337e0f918a55d1925396) ``` Xray 24.11.11 (Xray, Penetrates Everything.) 5a96ef6 (go1.23.2 linux/amd64) A unified platform for anti-censorship. ``` ## hyperfine, curl, direct outbound File: `bench_curl_direct.txt` Measurement of execution time of curl. Shows overhead of a proxying software. Proxies are set up to accept requests by SOCKSv5 and forward directly to net. units: ms (less is better) ### ~1.5M binary file over https from dc09.ru |proxy|min|avg|max| |:----|:-:|:-:|:-:| |no proxy|383.3|477.2|697.7| |sing-box|376.4|478.6|681.2| |xray|374.2|467.7|662.8| ### 162 bytes HTML over plain http from dc09.ru |proxy|min|avg|max| |:----|:-:|:-:|:-:| |no proxy|51.0|60.5|81.7| |sing-box|49.1|62.2|69.9| |xray|51.2|61.6|76.4| ### ~150K HTML over https from github.com |proxy|min|avg|max| |:----|:-:|:-:|:-:| |no proxy|365.3|402.1|449.8| |sing-box|338.6|390.5|445.5| |xray|342.3|390.8|426.0| ## iperf3, proxied outbound Measurement of bandwidth with iperf3. Shows processing speed of a proxying software. Client proxy (sing-box or xray, specified by a table column) is connected to SOCKSv5, Trojan or VLESS inbound on dc09.ru; server proxy on dc09.ru is either sing-box or xray (heading before a table), accepts requests on all 3 inbounds; iperf3 server is on the same host as a server proxy. units: Mbit/s (more is better) ### no proxy File: `bench_iperf_noproxy.txt` *sender* 93.7 Mbit/s (*receiver* 91.4 Mbit/s) ### server is sing-box File: `bench_sb_*.txt` |protocol|sing-box|xray client| |:-------|:------:|:---------:| |SOCKSv5|102.0 (91.3)|102.0 (91.3)| |Trojan|101.3 (91.0)|100.5 (90.6)| |VLESS|101.3 (91.3)|101.5 (90.7)| ### server is xray File: `bench_xray_*.txt` |protocol|sing-box|xray client| |:-------|:------:|:---------:| |SOCKSv5|101.5 (91.3)|103.0 (91.4)| |Trojan|100.1 (90.0)|100.5 (90.6)| |VLESS|99.6 (91.1)|102.0 (91.1)|