Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
多态参数函数 vs 固定类型参数函数 性能测试
(version: 1)
Comparing performance of:
多态 vs 固定
Created:
4 months ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const string3 = '3'; const number3 = 3; const add = (a,b) => { return a+b; }
Tests:
多态
for (let i=0; i < 1e5; i++) { const a = Math.random(); const b= Math.random(); const d = Math.random(); add(a,b); add(string3,d); }
固定
for (let i=0; i < 1e5; i++) { const a = Math.random(); const b= Math.random(); const d = Math.random(); add(a,b); add(number3,d); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
多态
固定
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
4 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0
Browser/OS:
Chrome 143 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
多态
221.1 Ops/sec
固定
704.4 Ops/sec
Related benchmarks:
Set vs object
Set vs object
Lodash _.some vs _.includes
String concatenation vs element creation 2
Split vs Spread (randomized)
lodash _.some vs Array.some
generateRandomString
endsWith vs at vs trimEnd vs Regex
JS string split fix Len
Comments
Confirm delete:
Do you really want to delete benchmark?