my favorite

2012/03/19

Formula is the king


Recently I am thinking how to master javascript performance

I noticed several discussions about recursive and iteration. Fibonacci! (yes, super boring recursive examples but it works quite well for lots of students)

I tried to implement it in javascript and run it in V8 engine with node-bench

Model: MBA
CPU: 1.86G C2D
RAM: 2G

formula
Raw:
 > 7153.846153846154
 > 7283.716283716284
 > 7059.94005994006
 > 7017.982017982018
 > 7074.925074925075
Average (mean) 7118.081918081918

iteration
Raw:
 > 1230.7692307692307
 > 1243.7562437562437
 > 1237.7622377622379
 > 794.2057942057942
 > 1237.7622377622379
Average (mean) 1148.851148851149

recursive
Raw:
 > 0.03229348317509526
 > 0.03268080656230596
 > 0.032544667556220916
 > 0.03117401334247771
 > 0.03111581305619516
Average (mean) 0.031961756738458996

Above results doesn't shock me but it does REMIND me that Formula is always a good point to deal with calculation

No comments:

BIO

Taipei, GuTing, Taiwan

huang47 | personal

huang47 | personal