From 96e5ced8791e7a5e1f4d1d3d8e59c6d14cf7a529 Mon Sep 17 00:00:00 2001 From: cyan <> Date: Sat, 22 Jul 2006 06:15:50 +0000 Subject: [PATCH] * As per Deuce, optimize do_join. Tests show that a regexp search is much faster by using system.timer to measure CPU usage over 10,000 loops: test 1 (Cyan's Method): 5.031109094619751 test 2 (Deuce's Method): 0.26767897605895996 --- exec/load/ircd_channel.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/exec/load/ircd_channel.js b/exec/load/ircd_channel.js index 3f725d3dda..c4bbcf38b5 100644 --- a/exec/load/ircd_channel.js +++ b/exec/load/ircd_channel.js @@ -546,9 +546,7 @@ function IRCClient_do_join(chan_name,join_key) { return 0; } for (theChar in chan_name) { - var theChar_code = chan_name[theChar].charCodeAt(0); - if ((theChar_code <= 32) || (theChar_code == 44) || - (chan_name[theChar].charCodeAt(0) == 160)) { + if(chan_name.search(/[\x00-\x20\x2c\xa0]/)!=-1) { if (this.local) this.numeric(479, chan_name + " :Channel name contains illegal characters."); -- GitLab