Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUSHclient
➜ Lua
➜ Repeated appends slowing down Lua
Repeated appends slowing down Lua
|
Posting of new messages is disabled at present.
Refresh page
Posted by
| Cage_fire_2000
USA (119 posts) Bio
|
Date
| Wed 15 Oct 2008 04:24 PM (UTC) Amended on Wed 15 Oct 2008 04:33 PM (UTC) by Cage_fire_2000
|
Message
| At least that's what I think the problem is. In my Paste_As_MUSH plugin, since I converted it to Lua, I just tried encoding something and it ran somewhat slow. I believe it's due to the fact that it goes through each character and appends an escaped version of it to an output string, and from what I read in the PiL guide(under reading files) that makes the garbage collector run wild because each time you append it throws out the old string. So for a string 500 characters long, it might throw out 500 strings. Is there any more efficient way of appending?
Edit: I tried posting my plugin but it's too long. I'll link to my website's copy. http://geocities.com/cage_fire_2000/Paste_As_MUSH.xml | Top |
|
Posted by
| Cage_fire_2000
USA (119 posts) Bio
|
Date
| Reply #1 on Wed 15 Oct 2008 04:37 PM (UTC) |
Message
| Hmm, never mind, this table.concat() looks promising. | Top |
|
Posted by
| WillFa
USA (525 posts) Bio
|
Date
| Reply #2 on Wed 15 Oct 2008 04:41 PM (UTC) |
Message
| Check this out:
http://www.lua.org/notes/ltn009.html
| Top |
|
Posted by
| Cage_fire_2000
USA (119 posts) Bio
|
Date
| Reply #3 on Wed 15 Oct 2008 04:56 PM (UTC) |
Message
| Alright, thanks for the link, but that seems like a rather complicated solution, and I don't have time to decypher it, I just converted it to use table.insert() instead of appending a string, and at the end used table.concat() it's much better now. I've uploaded version 1.2 to my website. | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
13,803 views.
Posting of new messages is disabled at present.
Refresh page
top