{"ScriptPreparationCode":"function sort1(a, b) {\r\n // ip \u6392\u5E8F\r\n const num1 = Number(\r\n (a.ip || (typeof a === \u0022string\u0022 \u0026\u0026 a) || \u0022\u0022)\r\n .split(\u0022.\u0022)\r\n .map((num) =\u003E \u0060000${num}\u0060.slice(-3))\r\n .join(\u0022\u0022)\r\n );\r\n const num2 = Number(\r\n (b.ip || (typeof b === \u0022string\u0022 \u0026\u0026 b) || \u0022\u0022)\r\n .split(\u0022.\u0022)\r\n .map((num) =\u003E \u0060000${num}\u0060.slice(-3))\r\n .join(\u0022\u0022)\r\n );\r\n return num1 - num2;\r\n}\r\n\r\nfunction sort2(a, b) {\r\n // ip \u6392\u5E8F\r\n const arr1 = (a.ip || (typeof a === \u0022string\u0022 \u0026\u0026 a) || \u0022\u0022).split(\u0022.\u0022);\r\n const arr2 = (b.ip || (typeof b === \u0022string\u0022 \u0026\u0026 b) || \u0022\u0022).split(\u0022.\u0022);\r\n\r\n for (let i = 0; i \u003C arr1.length; i\u002B\u002B) {\r\n const num1 = Number(arr1[i]);\r\n const num2 = Number(arr2[i]);\r\n if (num1 !== num2) {\r\n return num1 \u003E num2 ? 1 : -1;\r\n }\r\n }\r\n return 0;\r\n}","TestCases":[{"Name":"sort1","Code":"for(let i = 0; i \u003C 10000; i \u002B\u002B) {\r\n sort1({ip: \u0022192.168.0.1\u0022}, {ip: \u0022192.168.0.2\u0022});\r\n sort1({ip: \u0022192.168.0.2\u0022}, {ip: \u0022192.168.0.1\u0022});\r\n sort1({ip: \u0022192.168.100.1\u0022}, {ip: \u0022192.168.100.2\u0022});\r\n sort1({ip: \u0022192.168.100.2\u0022}, {ip: \u0022192.168.100.1\u0022});\r\n sort1({ip: \u0022192.168.50.100\u0022}, {ip: \u0022192.168.50.200\u0022});\r\n sort1({ip: \u0022192.168.50.200\u0022}, {ip: \u0022192.168.50.100\u0022});\r\n sort1({ip: \u0022192.168.150.100\u0022}, {ip: \u0022192.168.150.200\u0022});\r\n sort1({ip: \u0022192.168.150.200\u0022}, {ip: \u0022192.168.150.100\u0022});\r\n sort1({ip: \u0022192.168.150.200\u0022}, {ip: \u0022192.168.150.200\u0022});\r\n}","IsDeferred":false},{"Name":"sort2","Code":"for(let i = 0; i \u003C 10000; i \u002B\u002B) {\r\n sort2({ip: \u0022192.168.0.1\u0022}, {ip: \u0022192.168.0.2\u0022});\r\n sort2({ip: \u0022192.168.0.2\u0022}, {ip: \u0022192.168.0.1\u0022});\r\n sort2({ip: \u0022192.168.100.1\u0022}, {ip: \u0022192.168.100.2\u0022});\r\n sort2({ip: \u0022192.168.100.2\u0022}, {ip: \u0022192.168.100.1\u0022});\r\n sort2({ip: \u0022192.168.50.100\u0022}, {ip: \u0022192.168.50.200\u0022});\r\n sort2({ip: \u0022192.168.50.200\u0022}, {ip: \u0022192.168.50.100\u0022});\r\n sort2({ip: \u0022192.168.150.100\u0022}, {ip: \u0022192.168.150.200\u0022});\r\n sort2({ip: \u0022192.168.150.200\u0022}, {ip: \u0022192.168.150.100\u0022});\r\n sort2({ip: \u0022192.168.150.200\u0022}, {ip: \u0022192.168.150.200\u0022});\r\n}\r\n","IsDeferred":false}]}