ratchet icon indicating copy to clipboard operation
ratchet copied to clipboard

Don't concatenate in a loop

Open daurnimator opened this issue 14 years ago • 1 comments

You should never append to a lua string in a loop: add elements to a table then use table.concat.

Seen @ https://github.com/icgood/ratchet/blob/master/src/zmq.c#L372

daurnimator avatar Nov 24 '11 21:11 daurnimator

Also found: https://github.com/icgood/ratchet/blob/master/src/http/common.lua#L19 https://github.com/icgood/ratchet/blob/master/src/http/client.lua#L27 https://github.com/icgood/ratchet/blob/master/src/http/client.lua#L72 https://github.com/icgood/ratchet/blob/master/src/http/server.lua#L26 https://github.com/icgood/ratchet/blob/master/src/http/server.lua#L133

https://github.com/icgood/ratchet/blob/master/src/smtp/client.lua#L101 https://github.com/icgood/ratchet/blob/master/src/smtp/common.lua#L83 https://github.com/icgood/ratchet/blob/master/src/smtp/common.lua#L462

https://github.com/icgood/ratchet/blob/master/src/socketpad/init.lua#L146

daurnimator avatar Nov 24 '11 21:11 daurnimator