Author Topic: Lua parsing vs. PxUtilities parser  (Read 1701 times)

0 Members and 1 Guest are viewing this topic.

Offline bluebear

  • Double Ace
  • *
  • Posts: 116
  • Karma: +12/-0
  • Life is a bitch - And then you marry one!
Lua parsing vs. PxUtilities parser
« on: 17 April, 2006, 12:14:37 »
A test was made by me and American Idiot.

2 Lua 5.0.2 scripts, 1 uses pure lua to parse, 1 use PxUtilities.dll to parse.

Both script parsed 5.000.000 $ConnectToMe's

The results:
? Pure lua parsing:
? ? Duration: 34406 ms
? ? 00:00:34.406

? Parsing with PxUtilities:
? ? Duration: 8016 ms
? ? 00:00:08.016

The results shows that parsing DcCommands with PxUtilities is over 4 times faster than plain lua!
Means that I will add the full DC Command parser into this lib, and it should be used by all scripts to parse DC Commands with i think.
Sincerely,
bluebear
--
http://www.thewildplace.dk/ is is closed - Use the following mirrors instead
http://bluebear.psycho-chihuahua.net
http://pxextension.piratez.dk/
[Lua extensions - Chat stats - YnHub PMSpy - DC Source code - and more]

PtokaX forum

Lua parsing vs. PxUtilities parser
« on: 17 April, 2006, 12:14:37 »

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 730
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
Re: Lua parsing vs. PxUtilities parser
« Reply #1 on: 17 April, 2006, 13:06:35 »
So does this split up DC commands? Great. Happy Easter then.  ;D
Everything could have been anything else and it would have just as much meaning.

Offline bluebear

  • Double Ace
  • *
  • Posts: 116
  • Karma: +12/-0
  • Life is a bitch - And then you marry one!
Re: Lua parsing vs. PxUtilities parser
« Reply #2 on: 17 April, 2006, 13:59:34 »
For a command like $ConnectToMe it will be like this:

invalid, nick, IP, port = Parse.CTM(data)
if invalid then
? ?if invalid == 1 then
? ? ? -- Bad IP (out of range/and such)
? ?elseif invalid == 2 then
? ? ? -- IP is in a local range (eg. 192.168.*.*)
? ?elseif invalid == 3 then
? ? ? -- port number is out of range or otherwise invalid
? ?elseif invalid == 4 then
? ? ? -- Nickname is missing or this was not a $ConnectToMe
? ?end
else
? -- work with data
end

I just did some more speed tests.. On 5000 commands its only twice as fast, on 5.000.000 its 4 times faster, on 50.000.000 its 5 times faster..
The details of what the parser will check will depend on what ptokax already checked it self first...
For example, if ptokax it self checks if IP is correct then theres no need to do so in the lib.. The obove code was only a sample.. THis has not been coded yet, only for 1 command for the speed test :)
Sincerely,
bluebear
--
http://www.thewildplace.dk/ is is closed - Use the following mirrors instead
http://bluebear.psycho-chihuahua.net
http://pxextension.piratez.dk/
[Lua extensions - Chat stats - YnHub PMSpy - DC Source code - and more]

PtokaX forum

Re: Lua parsing vs. PxUtilities parser
« Reply #2 on: 17 April, 2006, 13:59:34 »