jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
We test different algorithms for converting the string to the array of chars.
const str = "The facts of the case are simple. Sir Charles Baskerville was in the habit every night before going to bed of walking down the famous Yew Alley of Baskerville Hall. The evidence of the Barrymores shows that this had been his custom. On the 4th of May Sir Charles had declared his intention of starting next day for London, and had ordered Barrymore to prepare his luggage. That night he went out as usual for his nocturnal walk, in the course of which he was in the habit of smoking a cigar. He never returned. At twelve o'clock Barrymore, finding the hall door still open, became alarmed, and, lighting a lantern, went in search of his master. The day had been wet, and Sir Charles's footmarks were easily traced down the Alley. Half-way down this walk there is a gate which leads out on to the moor. There were indications that Sir Charles had stood for some little time here. He then proceeded down the Alley, and it was at the far end of it that his body was discovered. One fact which has not been explained is the statement of Barrymore that his master's footprints altered their character from the time that he passed the moor-gate, and that he appeared from thence onward to have been walking upon his toes. One murphy, a gipsy horse-dealer, was on the moor at no great distance at the time, but he appears by his own confession to have been the worse for drink. He declares that he heard cries, but is unable to state from what direction they came. No signs of violence were to be discovered upon Sir Charles's person, and though the doctor's evidence pointed to an almost incredible facial distortion--so great that Dr. mortimer refused at first to believe that it was indeed his friend and patient who lay before him--it was explained that that is a symptom which is not unusual in cases of dyspnoea and death from cardiac exhaustion. This explanation was borne out by the post-mortem examination, which showed long-standing organic disease, and the coroner's jury returned a verdict in accordance with the medical evidence. It is well that this is so, for it is obviously of the utmost importance that Sir Charles's heir should settle at the Hall and continue the good work which has been so sadly interrupted. Had the prosaic finding of the coroner not finally put an end to the romantic stories which have been whispered in connection with the affair, it might have been difficult to find a tenant for Baskerville Hall. It is understood that the next of kin is mr. Henry Baskerville, if he be still alive, the son of Sir Charles Baskerville's younger brother. The young man when last heard of was in America, and inquiries are being instituted with a view to informing him of his good fortune.";
Ready to run.
Test | Ops/sec | |
---|---|---|
.split() |
| ready |
Array.from() |
| ready |
... Spread operator |
| ready |
[] + for + .push() |
| ready |
array + for |
| ready |
[] + for in + .push() |
| ready |
.match() + RegExp |
| ready |
.match() + RegExp #2 |
| ready |
[] + while + .push() |
| ready |
array + while |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.