Content deleted Content added
m fix links for moved module |
update to show current results |
||
Line 1:
==Overview==
This module provides
#[[Template:Convert/sandboxlua]] – template which invokes the module
#[[Template:Convert/testcases]] – template tests (see below)
#[[Module:Convert]] – module to convert units
#[[Module:Convert/data]] – module with unit definitions, used by #3
#[[User:Johnuniq/Conversion data]] – master list of unit definitions
#[[User:Johnuniq/Making the units table]] – program to translate #5 to #4
#[[Template talk:Convert/Archive February 2013#Lua Module:Convert|Talk archive]] –
Usage examples:
*<code><nowiki>{{convert/sandboxlua|5.2|m|ftin}}</nowiki></code> → {{convert/sandboxlua|5.2|m|ftin}}
*<code><nowiki>{{convert/sandboxlua|5+3/8|in}}</nowiki></code> → {{convert/sandboxlua|5+3/8|in}}
*<code><nowiki>{{convert/sandboxlua|6|ft|3|in|hand}}</nowiki></code> → {{convert/sandboxlua|6|ft|3|in|hand}}
*<code><nowiki>{{convert/sandboxlua|60|x|120|m|ft}}</nowiki></code> → {{convert/sandboxlua|60|x|120|m|ft}}
*<code><nowiki>{{convert/sandboxlua|1|e12BTU/cuft|e9kJ/L|lk=on}}</nowiki></code> → {{convert/sandboxlua|1|e12BTU/cuft|e9kJ/L|lk=on}}
The [[Template:Convert/testcases|testcases]] show good agreement between the templates and the module. There are some minor rounding and other differences, and the only significant disagreements appear to be problems in the templates. Substantive differences occur at:
*[[Template:Convert/testcases/bytype/energy2|energy2]]: different default output for in.lbf
*[[Template:Convert/testcases/bytype/energypervolume|energypervolume]]: template problems
*[[Template:Convert/testcases/bytype/exhaustemission|exhaustemission]]: template problem
*[[Template:Convert/testcases/bytype/length2|length2]]: different micro sign (should be "µ" U+00B5, not "μ" GREEK SMALL LETTER MU U+03BC)
*[[Template:Convert/testcases/bytype/mole|mole]]: different micro sign
*[[Template:Convert/testcases/bytype/power|power]]: calorie disagreements
*[[Template:Convert/testcases/bytype/time|time]]: module cannot handle unit horse year (unit not used)
*[[Template:Convert/testcases/bytype/torque|torque]]: template problems and minor differences
*[[Template:Convert/testcases/bytype/volume|volume]]: template hectolitre problems
*[[Template:Convert/testcases/bytype/misc|misc]]: module cannot handle units note, spanner, wrench (units not used)
The module appears to correctly implement the main features of the template. There are some minor disagreements concerning rounding of results, and some units and options have not yet been implemented. More testing is needed. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 10:52, 26 April 2013 (UTC)
==Discussion==
::presuming that a page that requires data conversion might require many of them, and consideing the sheer size of [[Module:Convert/data]], you might want to look at the [[mw:Extension:Scribunto/Lua_reference_manual#mw.loadData|mw.loadData documentaion]] and see if you can use this to improve performance. peace - [[User:קיפודנחש|קיפודנחש (aka kipod)]] ([[User talk:קיפודנחש|talk]]) 16:45, 2 March 2013 (UTC)
:::Mentioned at http://test2.wikipedia.org/wiki/User:Johnuniq -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 17:13, 2 March 2013 (UTC)
:::Thanks, but this page is a little out of date, and I will update it with the info that WOSlinker linked to. My comment about "performance challenges" was written when I had not absorbed the fact that some testcase timeouts were due to use of <code>frame:preprocess</code>. It actually looks as if Module:Convert is reasonably fast, although I haven't yet hammered it. In [[User:Johnuniq/sandbox|my sandbox]], there are 122 calls of {{tl|convert/sandboxlua}}, and the HTML source shows the Lua time usage is 0.348s (2.8 ms per call). That makes me think that Lua is fast enough even with the current bloated modules. Nevertheless, I'm thinking of some ways I could improve performance and will update the "Plans" section above with info, possibly within a few hours. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 04:08, 3 March 2013 (UTC)
{{od|3}}I've removed the plans as they were obsolete. Also, while the testcase pages require a significant time to render, the convert module appears to be sufficiently fast, so there is no reason to look for ways to speed it up. I now have 1689 calls in [[User:Johnuniq/sandbox|my sandbox]], and the Lua time usage is about 1 millisecond per convert. There is a per-page overhead, and it looks like a small number of converts takes around 40 ms total. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 10:52, 26 April 2013 (UTC)
|