Anomie has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/341355 )
Change subject: Speed up PHP mw.ustring.gcodepoint
......................................................................
Speed up PHP mw.ustring.gcodepoint
It seems to be over 200 times faster to iterate over the array instead
of shifting off the front.
Change-Id: Id29a4739ae2bd5dac4197e110ea73f74794e6d9f
---
M engines/LuaCommon/lualib/mw.ustring.lua
1 file changed, 6 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto
refs/changes/55/341355/1
diff --git a/engines/LuaCommon/lualib/mw.ustring.lua
b/engines/LuaCommon/lualib/mw.ustring.lua
index 33e5e39..0825a73 100644
--- a/engines/LuaCommon/lualib/mw.ustring.lua
+++ b/engines/LuaCommon/lualib/mw.ustring.lua
@@ -29,8 +29,13 @@
checkType( 'gcodepoint', 2, i, 'number', true )
checkType( 'gcodepoint', 3, j, 'number', true )
local cp = gcodepoint_init( s, i, j or -1 )
+ local pos, len = 1, #cp
return function ()
- return table.remove( cp, 1 )
+ if pos <= len then
+ local tmp = cp[pos]
+ pos = pos + 1
+ return tmp
+ end
end
end
--
To view, visit https://gerrit.wikimedia.org/r/341355
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id29a4739ae2bd5dac4197e110ea73f74794e6d9f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Scribunto
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits