Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F5240
regexp_speed_comparison.js
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
•
bzimport
Nov 21 2014, 10:23 PM
2014-11-21 22:23:38 (UTC+0)
Size
820 B
Referenced Files
None
Subscribers
None
regexp_speed_comparison.js
View Options
var
itm
=
'100,000,000 this is not a number'
var
startTime
=
new
Date
()
for
(
var
i
=
0
;
i
<
100000
;
i
++
)
{
// method 1
// if (itm.match(/^[+-]?[\d,]+(\.[\d,]*)?([eE][+-]?[\d,]+)?\%?$/) || itm.match(/^[+-]?\.[\d,]+([eE][+-]?[\d,]+)?\%?$/) || itm.match(/^0x[\da-f]+$/i))
// var three = 2 + 1
// method 2
if
(
itm
.
match
(
/^[+-]?[\d,]+(?:\.[\d,]*)?(?:[eE][+-]?[\d,]+)?\%?$/
)
||
itm
.
match
(
/^[+-]?\.[\d,]+(?:[eE][+-]?[\d,]+)?\%?$/
)
||
itm
.
match
(
/^0x[\da-f]+$/i
))
var
three
=
2
+
1
//method 3
// if (itm.match(/^[+-]?(?:\d{1,3}(?:\,\d{3})*)*\.?\d*(?:[eE][+-]?\d+(?:\,\d{3})*)?[%\u00b0\u00bc\u00bd\u00be]?$/) && !itm.match(/^[eE]/))
// var three = 2 + 1
}
var
endTime
=
new
Date
()
//replace "WScript.echo" with "alert" or whatever you need to display the results
WScript
.
echo
(
endTime
-
startTime
)
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4801
Default Alt Text
regexp_speed_comparison.js (820 B)
Attached To
Mode
T17422: Wikibits patch #10 - more numbers
Attached
Detach File
Event Timeline
Log In to Comment