https://bugzilla.wikimedia.org/show_bug.cgi?id=48378
--- Comment #4 from Brad Jorsch <[email protected]> --- (In reply to comment #3) > (In reply to comment #2) > Thank you for your response! > > Any reason? In some quick testing here, they're both about the same speed > > (180-200µs each). > It is nice then! I was thinking that > - having 1 more argument > - and replacing the match in the string in place of simply returning it > would consume more resources. But it is probably optimised internally by > Lua... Actually, all the replacing logic for mw.ustring in Scribunto is in PHP, which itself uses the PCRE library (in C) to handle most of it. > > OTOH, that would require callers to know whether they should call > > mw.text.trim > > or mw.text.utrim. > Yes, like they have to choose between string or ustring library Which itself is unfortunate. At any rate, it's too late to make this sort of change to mw.text.trim now. But if there is a general need for a faster binary trimming function it would be possible to add mw.text.trimBytes (name to be bikeshedded later). -- You are receiving this mail because: You are the assignee for the bug. You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
