String.prototype.contains vs. lodash contains

Benchmark created on


Preparation HTML

<script src="//rawgithub.com/lodash/lodash/8e25591212ec41967a29c9cb4dc1b0733c81f954/dist/lodash.js"></script>
<script>String.prototype.nativeContains = String.prototype.contains; delete String.prototype.contains;</script>
<script src="https://rawgithub.com/mathiasbynens/String.prototype.contains/master/contains.js"></script>
<script>String.prototype.mthsContains = String.prototype.contains; delete String.prototype.contains;</script>
<script src="https://rawgithub.com/paulmillr/es6-shim/master/es6-shim.js"></script>
<script>String.prototype.paulsContains = String.prototype.contains</script>

Test runner

Ready to run.

Testing in
TestOps/sec
es6-shim contains
'hello boring world'.paulsContains('boring')
ready
Mathias' contains
'hello boring world'.mthsContains('boring')
ready
native contains
'hello boring world'.nativeContains('boring')
ready
Lo-Dash contains (not 100% equivalent)
_.contains('hello boring world', 'boring')
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.