]> source.dussan.org Git - rspamd.git/commit
[Minor] Microoptimize lua_util.str_endswith 4093/head
authorAnton Yuzhaninov <citrin+git@citrin.ru>
Sat, 26 Feb 2022 13:56:36 +0000 (13:56 +0000)
committerAnton Yuzhaninov <citrin+git@citrin.ru>
Sat, 26 Feb 2022 13:56:36 +0000 (13:56 +0000)
commit431b3b892f0dd29581406dcc4ed690358d5780ca
tree58997fbb1db98a33f6eea12ba550ec5789ea3616
parentba7f6982b0b582b56e48da778784315b5d63d2be
[Minor] Microoptimize lua_util.str_endswith

Use find to check string suffix instead of sub (which involves string
interning of a returned string).  Benchmarks with LuaJIT 2.1.0 shows
that an option with find is significantly faster.

While here added unit test for this function.
lualib/lua_util.lua
test/lua/unit/lua_util.misc.lua