| 1234567891011121314151617181920212223242526272829303132 |
- --------------------------------------
- -- ..
- local text
- local t = os.clock()
- text = ""
- for i = 1, 10000 do
- text = text .. tostring(i)
- end
- print("[1] time: " ,os.clock() - t)
- --------------------------------------
- -- format
- local string_format = string.format
- t = os.clock()
- text = ""
- for i = 1, 10000 do
- text = string_format("%s%s", text, tostring(i))
- end
- print("[2] time: " ,os.clock() - t)
- --------------------------------------
- -- concat
- local list = {}
- local table_insert = table.insert
- t = os.clock()
- text = ""
- for i = 1, 10000 do
- table_insert(list, tostring(i))
- end
- text = table.concat(list, '')
- print("[3] time: " ,os.clock() - t)
- os.execute("PAUSE")
|