MatthewMueller/cheerio — pull request #412 by kpdecker (2014-03-11 02:45:25+00:00)
Title: Optimize manipulation methods

Does reduce empty performance but this is due to a bug fix that caused replaceWith to corrupt the siblings object on reinsert.

Test: manipulation - append (file: jquery.html)
cheerio x 4,579 ops/sec ±18.36% (57 runs sampled)
old x 1,692 ops/sec ±13.21% (39 runs sampled)
Fastest: cheerio

Test: manipulation - prepend (file: jquery.html)
cheerio x 2,886 ops/sec ±35.24% (39 runs sampled)
old x 1,627 ops/sec ±19.80% (26 runs sampled)
Fastest: cheerio

Test: manipulation - after (file: jquery.html)
cheerio x 2,383 ops/sec ±53.63% (39 runs sampled)
old x 1,569 ops/sec ±29.27% (33 runs sampled)
Fastest: cheerio

Test: manipulation - before (file: jquery.html)
cheerio x 2,547 ops/sec ±64.05% (43 runs sampled)
old x 1,682 ops/sec ±22.53% (35 runs sampled)
Fastest: cheerio

Test: manipulation - remove (file: jquery.html)
cheerio x 48,693 ops/sec ±4.05% (81 runs sampled)
old x 32,029 ops/sec ±41.81% (68 runs sampled)
Fastest: cheerio

Test: manipulation - replaceWith (file: jquery.html)
cheerio x 345 ops/sec ±3.95% (75 runs sampled)
old x 303 ops/sec ±5.46% (74 runs sampled)
Fastest: cheerio

Test: manipulation - empty (file: jquery.html)
cheerio x 80,074 ops/sec ±5.88% (78 runs sampled)
old x 265,760 ops/sec ±9.57% (68 runs sampled)
Fastest: cheerio