LINUX.ORG.RU

История изменений

Исправление LightDiver, (текущая версия) :

function test222(n1, n2)
    local temp
    local time1 = GetTime()
    for i = 1, n1 do
        temp = #ns_chat_log_line_q_p["лог_чат"][10]
        --print(temp)
    end
    print("Прошло: " .. GetTime()-time1)
    local time1 = GetTime()
    for i = 1, n1 do
        temp = utf8len(ns_chat_log_line_q_p["лог_чат"][10])
        --print(temp)
    end
    print("Прошло: " .. GetTime()-time1)
    local time1 = GetTime()
    for i = 1, n1 do
        temp = utf8myLen2(ns_chat_log_line_q_p["лог_чат"][10])
        --print(temp)
    end
    print("Прошло: " .. GetTime()-time1)
end

Обе мои функции локализованы в начале файла для доп оптимизиации и всеравно это на порядки медленнее нативного. Регулярка самая быстрая пока.

Исходная версия LightDiver, :

function test222(n1, n2)
    local temp
    local time1 = GetTime()
    for i = 1, n1 do
        temp = #ns_chat_log_line_q_p["лог_чат"][10]
        --print(temp)
    end
    print("Прошло: " .. GetTime()-time1)
    local time1 = GetTime()
    for i = 1, n1 do
        temp = utf8len(ns_chat_log_line_q_p["лог_чат"][10])
        --print(temp)
    end
    print("Прошло: " .. GetTime()-time1)
    local time1 = GetTime()
    for i = 1, n1 do
        temp = utf8myLen2(ns_chat_log_line_q_p["лог_чат"][10])
        --print(temp)
    end
    print("Прошло: " .. GetTime()-time1)
end