Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
[Sort selected first] Sort vs remove and concat
(version: 0)
Order of original list preserved
Comparing performance of:
Dumb Sort vs Subtract and concat
Created:
5 years ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
Script Preparation code:
const words = [`Grass`, `above`, `fowl`, `replenish`, `fifth`, `cattle`, `moveth`, `divide`, `youll`, `had`, `moving`, `Which`, `created`, `give`, `divide`, `cattle`, `Subdue`, `seas`, `one`, `form`, `stars`, `Fill`, `fish`, `god`, `cattle`, `unto`, `of`, `likeness`, `image`, `first`, `first`, `own`, `set`, `second`, `Great`, `saw`, `whose`, `was`, `fourth`, `tree`, `them`, `cattle`, `very`, `good`, `kind`, `seas`, `brought`, `them`, `for`, `living`, `yielding`, `dominion`, `without`, `let`, `bearing`, `fourth`, `heaven`, `midst`, `said`, `divided`, `moved`, `gathered`, `replenish`, `their`, `fifth`, `hath`, `lesser`, `man`, `without`, `waters`, `above`, `Forth`, `fish`, `void`, `image`, `from`, `have`, `seas`, `in`, `you`, `herb`, `saying`, `theyre`, `saw`, `above`, `one`, `shed`, `midst`, `said`, `grass`, `us`, `Also`, `our`, `night`, `Seas`, `for`, `under`, `Tree`, `made`, `unto`, `void`, `deep`, `so`, `midst`, `rule`, `unto`, `under`, `from`, `Shall`, `face`, `was`, `which`, `replenish`, `upon`, `good`, `brought`, `Gathering`, `youll`, `From`, `lights`, `without`, `image`, `theyre`, `our`, `forth`, `our`, `cant`, `Fill`, `under`, `green`, `fill`, `firmament`, `to`, `was`, `kind`, `multiply`, `after`, `third`, `doesnt`, `fruit`, `thing`, `own`, `Open`, `subdue`, `Subdue`, `third`, `theyre`, `a`, `Place`, `subdue`, `bring`, `without`, `fourth`, `him`, `life`, `tree`, `created`, `fish`, `fowl`, `yielding`, `Had`, `divided`, `green`, `gathering`, `Wont`, `void`, `isnt`, `firmament`, `whales`, `made`, `dominion`, `darkness`, `great`, `fish`, `youre`, `beast`, `he`, `seasons`, `fish`, `Also`, `above`, `two`, `spirit`, `so`, `spirit`, `light`, `them`, `shall`, `of`, `light`, `Was`, `herb`, `whose`, `place`, `him`, `youll`, `rule`, `Made`, `evening`, `third`, `over`, `so`, `meat`, `morning`, `lights`, `shall`, `great`, `sixth`, `beginning`, `a`, `there`, `seasons`, `seasons`, `all`, `shall`, `moving`, `morning`, `which`, `day`, `there`, `void`, `face`, `was`, `land`, `dont`, `our`, `He`, `had`, `appear`, `their`, `abundantly`, `that`, `you`, `which`, `fifth`, `god`, `waters`, `morning`, `winged`, `from`, `his`, `the`, `Male`, `yielding`, `first`, `place`, `our`, `moved`, `stars`, `cant`, `firmament`, `shall`, `theyre`, `Open`, `dominion`, `blessed`, `fifth`, `cant`, `male`, `void`, `life`, `he`, `fowl`, `is`, `without`, `of`, `third`, `made`, `Without`, `Meat`, `had`, `set`, `god`, `seed`, `evening`, `bearing`, `thing`, `deep`, `image`, `set`, `lesser`, `fruit`, `likeness`, `whose`, `abundantly`, `male`, `life`, `moved`, `shed`, `bring`, `Fruitful`, `fourth`, `may`, `had`, `i`, `without`, `Whose`, `waters`, `sea`, `created`, `wherein`, `green`, `kind`, `sixth`, `very`, `creature`, `void`, `Signs`, `make`, `gathered`, `living`, `shed`, `isnt`, `yielding`, `given`, `in`, `fowl`, `air`, `saw`, `it`, `said`, `our`, `thing`, `may`, `given`, `whales`, `from`, `gathered`, `bearing`, `over`, `night`, `air`, `is`, `blessed`, `above`, `yielding`, `fill`, `made`, `Place`, `theyre`, `them`, `is`, `have`, `made`, `third`, `Whose`, `bearing`, `darkness`, `Waters`, `fruitful`, `rule`, `day`, `god`, `let`, `from`, `i`, `unto`, `Spirit`, `Have`, `face`, `moved`, `gathering`, `years`, `subdue`, `grass`, `Image`, `cant`, `youre`, `You`, `isnt`, `from`, `land`, `Man`, `in`, `rule`, `him`, `creepeth`, `without`, `Replenish`, `deep`, `image`, `appear`, `midst`, `after`, `grass`, `Wherein`, `cattle`, `behold`, `us`, `dry`, `also`, `youre`, `beast`, `Years`, `creature`, `heaven`, `fruitful`, `divide`, `that`, `i`, `open`, `wont`, `let`, `day`, `Lights`, `moveth`, `grass`, `void`, `second`, `meat`, `brought`, `fourth`, `hath`, `isnt`, `were`, `Darkness`, `upon`, `air`, `subdue`, `creeping`, `called`, `after`, `winged`, `man`, `Also`, `creature`, `midst`, `shed`, `two`, `shed`, `wont`, `give`, `meat`, `May`, `whales`, `dont`, `first`, `said`, `fourth`, `that`, `thing`, `Bearing`, `likeness`, `second`, `signs`, `the`, `wont`, `whose`, `second`, `Appear`, `Lights`, `together`, `also`, `and`, `meat`, `one`, `Signs`, `very`, `Appear`, `Youll`, `his`, `abundantly`, `make`, `Divide`, `years`, `deep`, `creature`, `male`, `third`, `two`, `hath`, `divided`, `of`, `created`, `abundantly`, `created`, `great`, `after`, `gathered`, `Moved`, `youll`, `firmament`, `also`, `itself`, `seasons`, `Fish`, `subdue`, `a`, `Unto`, `beast`, `fifth`, `air`, `face`, `make`, `set`, `dry`, `a`, `multiply`, `under`, `doesnt`, `Spirit`, `us`, `lights`, `Shed`, `lesser`, `good`, `void`, `Also`, `appear`, `fly`, `bring`, `beast`, `abundantly`, `creepeth`, `Beast`, `Herb`, `divide`, `created`, `The`, `and`, `creature`, `a`, `beast`, `waters`, `own`, `them`, `yielding`, `blessed`, `fish`, `beast`, `shed`, `moveth`, `so`, `fish`, `wherein`, `bring`, `face`, `there`, `from`, `forth`, `given`, `and`, `wherein`, `creepeth`, `moving`, `Face`, `male`, `there`, `firmament`, `forth`, `above`, `from`, `fourth`, `seed`, `let`, `have`, `morning`, `Us`, `us`, `Shall`, `creature`, `Stars`, `hath`, `youre`, `All`, `Stars`, `earth`, `Divided`, `seas`, `earth`, `herb`, `creepeth`, `Moved`, `forth`, `meat`, `third`, `Upon`, `isnt`, `Every`, `fourth`, `that`, `to`, `second`, `air`, `two`, `rule`, `our`, `moveth`, `under`, `had`, `called`, `great`, `Upon`, `Man`, `living`, `beast`, `were`, `kind`, `Was`, `from`, `after`, `morning`, `light`, `herb`, `Lesser`, `moving`, `let`, `god`, `after`, `meat`, `deep`, `form`, `Form`, `man`, `herb`, `light`, `fill`, `brought`, `days`, `meat`, `stars`, `beginning`, `brought`, `he`, `to`, `bring`, `deep`, `had`, `were`, `bearing`, `made`, `appear`, `Whales`, `subdue`, `there`, `second`, `of`, `it`, `cattle`, `given`, `rule`, `Very`, `evening`, `Midst`, `all`, `for`, `fourth`, `lights`, `It`, `which`, `hath`, `Life`, `His`, `let`, `shed`, `sixth`, `you`, `Bearing`, `Two`, `a`, `second`, `rule`, `multiply`, `earth`, `Night`, `bearing`, `waters`, `beast`, `lesser`, `saying`, `kind`, `youll`, `given`, `and`, `place`, `which`, `so`, `given`, `Earth`, `for`, `bring`, `after`, `deep`, `abundantly`, `herb`, `shed`, `that`, `man`, `herb`, `he`, `one`, `him`, `our`, `waters`, `them`, `Subdue`, `open`, `fourth`, `tree`, `over`, `that`, `fill`, `created`, `fruit`, `god`, `his`, `man`, `Night`, `upon`, `itself`, `beast`, `set`, `own`, `Fowl`, `tree`, `hath`, `youre`, `great`, `of`, `subdue`, `greater`, `under`, `blessed`, `beast`, `sixth`, `without`, `fish`, `i`, `whales`, `in`, `set`, `to`, `dry`, `Man`, `Greater`, `lesser`, `void`, `man`, `theyre`, `bring`, `years`, `waters`, `image`, `youre`, `creature`, `one`, `tree`, `Blessed`, `forth`, `yielding`, `meat`, `winged`, `good`, `so`, `spirit`, `sea`, `lesser`, `male`, `wont`, `lesser`, `spirit`, `lesser`, `days`, `youll`, `evening`, `one`, `created`, `day`, `appear`, `theyre`, `female`, `gathered`, `set`, `he`, `life`, `the`, `Herb`, `youre`, `god`, `given`, `and`, `our`, `cattle`, `our`, `Third`, `divide`, `cant`, `Land`, `saw`, `Had`, `that`, `thing`, `and`, `subdue`, `light`, `moved`, `wont`, `youre`, `Forth`, `appear`, `together`, `be`, `seasons`, `For`, `life`, `there`, `man`, `darkness`, `lesser`, `place`, `sea`, `replenish`, `greater`, `two`, `female`, `rule`, `our`, `from`, `from`, `given`, `Let`, `youre`, `set`, `Lights`, `darkness`, `the`, `Days`, `living`, `herb`, `face`, `hath`, `gathering`, `bring`, `set`, `thing`, `winged`, `May`, `make`, `bearing`, `their`, `over`, `youre`, `over`, `man`, `sixth`, `grass`, `made`, `be`, `also`, `dont`, `a`, `green`, `two`, `above`, `which`, `may`, `all`, `gathering`, `i`, `made`, `Said`, `a`, `earth`, `in`, `man`, `made`, `man`, `moved`, `let`, `be`, `For`, `above`, `our`, `behold`, `after`, `which`, `air`, `yielding`, `us`, `so`, `moving`, `it`, `days`, `moving`, `god`, `face`, `was`, `yielding`, `said`, `called`, `our`, `our`, `midst`, `was`, `shall`, `replenish`, `first`, `lesser`, `appear`, `life`, `Blessed`, `of`, `us`, `waters`, `fifth`, `without`, `void`, `signs`, `after`, `over`, `yielding`, `hath`, `under`, `so`, `Our`, `green`, `so`, `our`, `in`, `subdue`, `that`, `had`, `Also`, `dont`, `good`, `there`, `from`, `their`, `gathering`, `thing`, `kind`, `wherein`, `Give`, `seas`, `morning`, `every`, `earth`, `fruit`, `creeping`, `seed`, `darkness`, `may`, `Thing`, `above`, `i`, `of`, `creature`, `darkness`, `Open`, `seed`, `in`, `shed`, `deep`, `make`, `beast`, `years`, `called`, `gathering`, `youre`, `set`, `midst`, `so`, `green`, `Divided`, `seasons`, `make`, `It`, `light`, `the`, `from`, `subdue`, `fill`, `life`, `gathered`, `air`, `over`, `Thing`, `heaven`, `had`, `given`, `called`, `wherein`, `over`, `light`, `great`, `fourth`, `fowl`, `is`, `shall`, `tree`, `wherein`, `bearing`, `lights`, `Fruitful`, `their`, `all`, `deep`, `heaven`, `Seas`, `created`, `brought`, `them`, `man`, `a`, `under`, `darkness`, `To`, `firmament`, `moving`, `replenish`, `herb`, `whose`, `them`, `creeping`, `fly`, `appear`, `First`, `above`, `us`, `Male`, `divided`, `and`, `place`, `called`, `them`, `all`, `under`, `Place`, `his`, `beast`, `behold`, `yielding`, `wont`, `years`, `creeping`, `herb`, `the`, `the`, `one`, `two`, `shed`, `called`, `unto`, `seas`, `greater`, `sixth`, `creepeth`, `fifth`, `living`, `meat`, `moved`, `Fruitful`, `isnt`, `stars`, `yielding`, `blessed`, `whales`, `their`, `Light`, `behold`, `shall`, `years`, `image`, `seed`, `evening`, `green`, `Wherein`, `abundantly`, `so`, `said`, `face`, `given`, `signs`, `replenish`, `above`, `female`, `land`, `heaven`, `heaven`, `over`, `kind`, `above`, `replenish`, `And`, `good`, `let`, `one`, `second`, `wherein`, `dont`, `place`, `fowl`, `great`, `signs`, `lesser`, `gathered`, `greater`, `were`, `itself`, `subdue`, `greater`, `cant`, `called`, `wherein`, `evening`, `created`, `behold`, `Male`, `dry`, `Fruitful`, `also`, `hath`, `them`, `him`, `unto`, `gathered`, `great`, `whose`, `good`, `After`, `night`, `without`, `fifth`, `First`, `a`, `us`, `air`, `saw`, `male`, `which`, `their`, `tree`, `earth`, `over`, `yielding`, `years`, `under`, `may`, `give`, `own`, `yielding`, `void`, `appear`, `saying`, `first`, `created`, `it`, `had`, `Appear`, `fish`, `make`, `Form`, `under`, `living`, `make`, `beginning`, `Theyre`, `life`, `likeness`, `and`, `meat`, `you`, `tree`, `darkness`, `beast`, `doesnt`, `divided`, `night`, `Open`, `were`, `fly`, `so`, `which`, `Them`, `shed`, `dry`, `shed`, `theyre`, `night`, `day`, `set`, `gathered`, `great`, `moveth`, `spirit`, `replenish`, `every`, `cattle`, `abundantly`, `god`, `In`, `make`, `winged`, `first`, `which`, `lights`, `seasons`, `our`, `which`, `tree`, `created`, `wont`, `form`, `living`, `brought`, `us`, `over`, `thing`, `fifth`, `let`, `creature`, `after`, `image`, `fourth`, `beast`, `wont`, `midst`, `place`, `place`, `Female`, `whose`, `Be`, `moving`, `lesser`, `form`, `gathered`, `cattle`, `grass`, `first`, `very`, `behold`, `years`, `set`, `years`, `very`, `land`, `sixth`, `so`, `subdue`, `Days`, `had`, `Heaven`, `one`, `kind`, `behold`, `wherein`, `divided`, `male`, `dry`, `fourth`, `his`, `grass`, `subdue`, `darkness`, `days`, `appear`, `bring`, `beginning`, `youll`, `lights`, `own`, `set`, `creeping`, `the`, `to`, `make`, `very`, `saw`, `kind`, `Abundantly`, `is`, `own`, `deep`, `likeness`, `of`, `saying`, `beginning`, `Heaven`, `Dry`, `one`, `Of`, `Thing`, `dont`, `replenish`, `gathered`, `seed`, `spirit`, `had`, `great`, `Fifth`, `wont`, `deep`, `multiply`, `place`, `blessed`, `Forth`, `created`, `very`, `you`, `from`, `Their`, `there`, `and`, `For`, `deep`, `abundantly`, `let`, `doesnt`, `dry`, `herb`, `wherein`, `created`, `blessed`, `cattle`, `Moved`, `all`, `wont`, `creepeth`, `god`, `Have`, `Whose`, `upon`, `midst`, `it`, `fill`, `divide`, `fifth`, `cant`, `youre`, `replenish`, `Kind`, `very`, `shed`, `creature`, `void`, `face`, `very`, `wont`, `whose`, `Land`, `itself`, `Subdue`, `seas`, `saw`, `great`, `Isnt`, `was`, `own`, `their`, `beginning`, `Moving`, `waters`, `lights`, `Set`, `evening`, `For`, `evening`, `signs`, `Evening`, `created`, `upon`, `brought`, `Bring`, `fish`, `Created`, `fowl`, `grass`, `A`, `light`, `midst`, `fifth`, `you`, `bearing`, `fowl`, `You`, `Divide`, `created`, `sea`, `set`, `Had`, `fish`, `man`, `void`, `years`, `theyre`, `deep`, `life`, `shall`, `Earth`, `tree`, `doesnt`, `our`, `image`, `us`, `greater`, `make`, `Without`, `was`, `that`, `two`, `shed`, `i`, `void`, `Make`, `that`, `together`, `their`, `tree`, `deep`, `great`, `he`, `creepeth`, `Fowl`, `fruit`, `creature`, `have`, `youll`, `to`, `of`, `together`, `earth`, `fly`, `day`, `two`, `moveth`, `gathered`, `fowl`, `creature`, `wont`, `morning`, `sixth`, `divide`, `subdue`, `face`, `multiply`, `meat`, `every`, `under`, `under`, `behold`, `saying`, `Isnt`, `Moveth`, `fill`, `sea`, `called`, `gathering`, `fish`, `thing`, `darkness`, `given`, `blessed`, `spirit`, `i`, `Good`, `dont`, `upon`, `After`, `brought`, `replenish`, `cattle`, `and`, `created`, `darkness`, `great`, `lights`, `Abundantly`, `dominion`, `bearing`, `blessed`, `tree`, `gathering`, `i`, `place`, `bearing`, `Lights`, `life`, `bring`, `i`, `them`, `sea`, `years`, `from`, `waters`, `seasons`, `together`, `god`, `there`, `green`, `be`, `seasons`, `Void`, `cattle`, `Abundantly`, `theyre`, `good`, `one`, `good`, `of`, `us`, `appear`, `years`, `bearing`, `lesser`, `Blessed`, `brought`, `beginning`, `sea`, `moving`, `creeping`, `void`, `thing`, `let`, `Midst`, `first`, `god`, `Also`, `whales`, `Void`, `Fruit`, `replenish`, `and`, `Tree`, `from`, `heaven`, `form`, `very`, `spirit`, `heaven`, `fly`, `fruit`, `whales`, `was`, `fruit`, `shall`, `You`, `day`, `so`, `waters`, `above`, `first`, `the`, `lesser`, `greater`, `waters`, `to`, `without`, `may`, `firmament`, `in`, `place`, `set`, `midst`, `greater`, `made`, `days`, `gathered`, `seas`, `fish`, `Shall`, `which`, `made`, `he`, `seas`, `there`, `Unto`, `green`, `place`, `After`, `was`, `fly`, `a`, `were`, `form`, `Deep`, `whose`, `abundantly`, `given`, `image`, `them`, `you`, `itself`, `creeping`, `fowl`, `green`, `gathering`, `itself`, `which`, `day`, `above`, `days`, `bring`, `be`, `theyre`, `their`, `so`, `land`, `God`, `morning`, `light`, `had`, `is`, `beginning`, `Was`, `lesser`, `from`, `beginning`, `were`, `it`, `the`, `tree`, `wherein`, `them`, `there`, `be`, `i`, `lights`, `subdue`, `moveth`, `yielding`, `beast`, `there`, `Had`, `God`, `for`, `thing`, `God`, `male`, `behold`, `had`, `good`, `that`, `light`, `great`, `Image`, `Living`, `give`, `in`, `male`, `sixth`, `wherein`, `so`, `creeping`, `itself`, `fruitful`, `wont`, `subdue`, `may`, `gathered`, `earth`, `own`, `said`, `from`, `whales`, `Winged`, `Grass`, `creepeth`, `midst`, `Day`, `bearing`, `sixth`, `third`, `creeping`, `second`, `for`, `firmament`, `dominion`, `dont`, `open`, `female`, `male`, `Seed`, `cant`, `night`, `hath`, `deep`, `abundantly`, `face`, `Moving`, `given`, `isnt`, `Shall`, `fill`, `Over`, `under`, `cattle`, `it`, `doesnt`, `fourth`, `morning`, `void`, `was`, `Fifth`, `them`, `From`, `kind`, `darkness`, `god`, `bearing`, `to`, `firmament`, `and`, `is`, `unto`, `air`, `male`, `firmament`, `day`, `place`, `likeness`, `cant`, `be`, `the`, `earth`, `From`, `bearing`, `the`, `dominion`, `very`, `yielding`, `theyre`, `Very`, `which`, `green`, `female`, `under`, `had`, `fifth`, `You`, `beginning`, `let`, `third`, `there`, `without`, `doesnt`, `you`, `Fly`, `appear`, `years`, `divide`, `wont`, `was`, `he`, `it`, `kind`, `green`, `creeping`, `man`, `The`, `night`, `open`, `in`, `You`, `also`, `be`, `for`, `fowl`, `it`, `man`, `cant`, `a`, `After`, `multiply`, `darkness`, `moved`, `heaven`, `shall`, `Earth`, `sea`, `i`, `beast`, `Living`, `also`, `life`, `seasons`, `moveth`, `in`, `moveth`, `earth`, `bring`, `fruitful`, `Without`, `us`, `creeping`, `From`, `upon`, `have`, `second`, `fifth`, `to`, `darkness`, `bring`, `heaven`, `saying`, `After`, `is`, `whales`, `Meat`, `two`, `darkness`, `kind`, `for`, `shed`, `appear`, `gathered`, `saw`, `earth`, `likeness`, `days`, `Lesser`, `be`, `be`, `blessed`, `wherein`, `first`, `it`, `beast`, `unto`, `Sixth`, `seed`, `our`, `which`, `green`, `behold`, `Given`, `whales`, `of`, `to`, `upon`, `had`, `fly`, `there`, `and`, `one`, `abundantly`, `fly`, `theyre`, `likeness`, `Fish`, `first`, `herb`, `called`, `grass`, `third`, `To`, `green`, `were`, `wherein`, `fish`, `third`, `Isnt`, `to`, `which`, `fourth`, `behold`, `lesser`, `forth`, `were`, `bearing`, `cattle`, `you`, `days`, `Beginning`, `Creature`, `him`, `without`, `hath`, `fruitful`, `wherein`, `wherein`, `dont`, `rule`, `image`, `created`, `youre`, `it`, `it`, `firmament`, `stars`, `whales`, `third`, `very`, `creeping`, `green`, `kind`, `behold`, `living`, `be`, `darkness`, `great`, `to`, `Theyre`, `fly`, `have`, `that`, `the`, `wont`, `god`, `Cattle`, `forth`, `beast`, `herb`, `yielding`, `fourth`, `place`, `you`, `whales`, `seasons`, `under`, `bring`, `dominion`, `seasons`, `all`, `fifth`, `under`, `creepeth`, `bring`, `every`, `him`, `made`, `without`, `every`, `shall`, `dominion`, `deep`, `man`, `seas`, `blessed`, `replenish`, `divided`, `after`, `yielding`, `thing`, `his`, `fowl`, `be`, `youre`, `Subdue`, `May`, `divided`, `over`, `the`, `rule`, `youll`, `itself`, `female`, `whales`, `After`, `morning`, `deep`, `Saying`, `form`, `all`, `Together`, `Theyre`, `female`, `Seasons`, `evening`, `our`, `after`, `sea`, `upon`, `earth`, `waters`, `herb`, `bearing`, `itself`, `earth`, `Morning`, `years`, `for`, `Night`, `was`, `appear`, `earth`, `the`, `of`, `Upon`, `thing`, `whales`, `heaven`, `fowl`, `spirit`, `unto`, `theyre`, `first`, `seed`, `female`, `itself`, `creeping`, `you`, `waters`, `dont`, `upon`, `were`, `own`, `let`, `Replenish`, `spirit`, `divide`, `gathering`, `for`, `over`, `fish`, `wont`, `unto`, `Own`, `first`, `life`, `man`, `seed`, `tree`, `youre`, `them`, `one`, `dominion`, `them`, `of`, `youll`, `Meat`, `forth`, `form`, `I`, `hath`, `above`, `and`, `of`, `void`, `darkness`, `one`, `firmament`, `signs`, `seed`, `be`, `given`, `male`, `upon`, `earth`, `lesser`, `image`, `is`, `image`, `good`, `meat`, `fill`, `morning`, `creeping`, `third`, `firmament`, `Replenish`, `And`, `land`, `days`, `our`, `darkness`, `face`, `created`, `from`, `fowl`, `grass`, `waters`, `have`, `herb`, `air`, `rule`, `man`, `Yielding`, `Cant`, `earth`, `place`, `there`, `man`, `saying`, `darkness`, `it`, `years`, `firmament`, `was`, `stars`, `air`, `whose`, `Also`, `blessed`, `stars`, `dominion`, `great`, `a`, `life`, `herb`, `give`, `second`, `Days`, `Were`, `green`, `night`, `firmament`, `under`, `give`, `were`, `saw`, `sea`, `god`, `brought`, `green`, `divide`, `fowl`, `youre`, `replenish`, `grass`, `Saw`, `the`, `fill`, `may`, `dry`, `upon`, `greater`, `shed`, `meat`, `Itself`, `earth`, `first`, `whose`, `their`, `that`, `was`, `darkness`, `female`, `seed`, `upon`, `All`, `Had`, `dominion`, `form`, `first`, `and`, `whales`, `seas`, `his`, `stars`, `Sixth`, `made`, `seasons`, `great`, `the`, `also`, `him`, `So`, `whose`, `two`, `greater`, `Of`, `were`, `that`, `Which`, `firmament`, `which`, `heaven`, `male`, `male`, `there`, `hath`, `stars`, `creepeth`, `night`, `gathering`, `every`, `days`, `divided`, `divided`, `seasons`, `living`, `heaven`, `for`, `brought`, `said`, `deep`, `dominion`, `light`, `be`, `dominion`, `to`, `Years`, `the`, `creeping`, `firmament`, `years`, `it`, `whose`, `firmament`, `hath`, `Dont`, `great`, `tree`, `yielding`, `Creeping`, `own`, `you`, `dont`, `over`, `shed`, `moving`, `Saying`, `upon`, `without`, `cattle`, `land`, `us`, `one`, `tree`, `be`, `upon`, `shed`, `behold`, `Is`, `his`, `divided`, `behold`, `is`, `us`, `firmament`, `signs`, `one`, `Upon`, `third`, `our`, `heaven`, `form`, `our`, `us`, `very`, `replenish`, `their`, `first`, `so`, `fly`, `open`, `Creepeth`, `bring`, `behold`, `him`, `creeping`, `beginning`, `sixth`, `fifth`, `itself`, `wherein`, `two`, `gathered`, `fish`, `Greater`, `said`, `every`, `green`, `image`, `he`, `cant`, `land`, `saying`, `for`, `so`, `it`, `in`, `Form`, `living`, `seasons`, `theyre`, `may`, `second`, `above`, `wherein`, `Grass`, `every`, `man`, `winged`, `air`, `herb`, `seasons`, `whose`, `seasons`, `Creeping`, `our`, `evening`, `fish`, `saying`, `give`, `form`, `years`, `fruit`, `Seasons`, `so`, `beast`, `days`, `shall`, `two`, `divide`, `Multiply`, `creature`, `Doesnt`, `great`, `male`, `moving`, `wherein`, `morning`, `thing`, `light`, `said`, `Theyre`, `youll`, `moved`, `creeping`, `after`, `Image`, `cant`, `years`, `itself`, `creepeth`, `divided`, `Air`, `Day`, `very`, `gathered`, `whales`, `green`, `unto`, `kind`, `unto`, `second`, `Have`, `is`, `beginning`, `Them`, `evening`, `subdue`, `man`, `yielding`, `yielding`, `Fish`, `There`, `abundantly`, `sea`, `abundantly`, `good`, `seasons`, `god`, `creepeth`, `man`, `good`, `saw`, `whales`, `shall`, `also`, `rule`, `have`, `it`, `sixth`, `his`, `open`, `herb`, `have`, `whales`, `of`, `them`, `without`, `said`, `Moved`, `is`, `us`, `Fourth`, `of`, `Seas`, `seas`, `lights`, `Upon`, `Sea`, `were`, `Fish`, `he`, `stars`, `greater`, `great`, `great`, `set`, `he`, `place`, `that`, `fowl`, `Set`, `divide`, `and`, `air`, `were`, `Unto`, `sixth`, `may`, `their`, `itself`, `Forth`, `Own`, `it`, `had`, `bearing`, `Evening`, `forth`, `a`, `Was`, `wherein`, `tree`, `grass`, `two`, `grass`, `thing`, `Land`, `Spirit`, `he`, `from`, `saw`, `morning`, `it`, `seasons`, `two`, `fruit`, `dominion`, `a`, `I`, `had`, `land`, `One`, `under`, `beast`, `firmament`, `Kind`, `set`, `behold`, `saw`, `heaven`, `earth`, `gathered`, `given`, `stars`, `Deep`, `place`, `itself`, `beast`, `place`, `seas`, `Our`, `wherein`, `you`, `youre`, `seas`, `creeping`, `winged`, `them`, `behold`, `herb`, `fruit`, `youll`, `that`, `face`, `fowl`, `Air`, `and`, `female`, `And`, `shall`, `life`, `beast`, `cant`, `His`, `rule`, `rule`, `image`, `created`, `may`, `lesser`, `Theyre`, `may`, `shall`, `day`, `i`, `shed`, `forth`, `you`, `winged`, `upon`, `cattle`, `replenish`, `whose`, `give`, `land`, `is`, `brought`, `appear`, `deep`, `abundantly`, `good`, `night`, `open`, `fly`, `Gathering`] selectedIds = [202, 262, 1559, 1800, 566, 757, 2065, 132, 1068, 1280, 406, 609, 695, 335, 140, 1353, 1816, 1471, 2433, 630, 2466, 1279, 969, 1629, 1108, 962, 1161, 435, 1420, 1890, 1481, 1147, 1739, 2028, 967, 767, 627, 35, 1221, 2165, 1622, 78, 2444, 937, 1115, 2248, 1151, 689, 946, 673, 2225, 782, 2241, 2280, 1404, 1651, 1273, 1149, 2370, 2084, 1313, 398, 99, 868, 988, 978, 1507, 740, 1415, 800, 272, 1658, 50, 1060, 460, 1726, 1462, 2333, 1301, 1935, 1598, 2134, 1160, 2286, 108, 2451, 1240, 517, 2473, 2125, 159, 1736, 979, 153, 1008, 805, 138, 766, 1002, 2085, 862, 1366, 1519, 964, 1110, 1378, 20, 923, 1267, 1567, 1400, 2183, 938, 1653, 1453, 534, 646, 1136, 1486, 1663, 1543, 254, 1176, 1291, 876, 264, 393, 209, 688, 2215, 1871, 693, 2297, 1259, 1335, 273, 1483, 2402, 9, 1987, 2371, 232, 2468, 632, 1217, 2311, 181, 921, 2258, 2019, 1000, 556, 2265, 480, 1183, 395, 19, 2253, 1824, 174, 866, 319, 1082, 2431, 2090, 1247, 1490, 2127, 1443, 1669, 1707, 596, 377, 1294, 1899, 2155, 1175, 281, 278, 555, 405, 508, 2332, 982, 718, 231, 2459, 160, 1227] list = words.reduce((l, word, index) => { l.push({id: index, label: word, isSelected: selectedIds.includes(index)}) return l }, [])
Tests:
Dumb Sort
const sortedList1 = list.sort((a,b) => { const isASelected = selectedIds.includes(a.id) const isBSelected = selectedIds.includes(b.id) if(isASelected && !isBSelected){ return 1 }else if (!isASelected && isBSelected){ return -1 }else { return list.indexOf(b) - list.indexOf(a) } })
Subtract and concat
const unselected = _.differenceWith(list, selectedIds, (el, id) => el.id === id) const selected = _.pickBy(list, (el) => selectedIds.includes(el)) const sortedList2 = _.concat(selected, unselected)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Dumb Sort
Subtract and concat
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Based on the provided data, I'll assume that I need to create a custom sorting function for a list of objects, where each object has an `id` property. The sorting should be done in a way that prioritizes selected items over unselected items and then by their original order. Here's a possible implementation: ```javascript const sortedList = _.pickBy(list, (el) => selectedIds.includes(el.id)) .concat(_.differenceWith(list, selectedIds, (el, id) => el.id === id)); ``` This code uses `_.pickBy` to select only the objects with `id` properties present in `selectedIds`, and then concatenates the result with the unselected items using `_.differenceWith`. However, this approach assumes that the selection status is already determined at compile time. If it's determined at runtime, you would need a more complex implementation that takes into account the dynamic selection status. To further optimize the code, consider adding some bounds checking to avoid unnecessary array indexing and sorting: ```javascript const sortedList = _.pickBy(list, (el) => selectedIds.includes(el.id)); let i = 0; for (const unselected of _.differenceWith(list, selectedIds)) { sortedList.push(unselected); if (sortedList.length > 1) { const temp = list[i++]; while (temp.id !== unselected.id && list.indexOf(temp) < list.indexOf(unselected)) { [list[list.indexOf(temp)], list[list.indexOf(unselected)]] = [unselected, temp]; } } } ``` This approach has a time complexity of O(n^2), which might not be suitable for large lists. For a more efficient solution, consider using a data structure like a binary search tree or a balanced binary search tree, such as an AVL tree or a red-black tree. For the "Dumb Sort" test case, here's a simple implementation that uses the original order of the list: ```javascript const sortedList = _.map(list, (el) => ({ id: el.id, label: el.label })); sortedList.sort((a, b) => { const indexA = list.indexOf(a); const indexB = list.indexOf(b); if (indexA < indexB) return -1; if (indexA > indexB) return 1; // If the indices are equal, preserve the original order return a.label.localeCompare(b.label); }); ``` This approach has a time complexity of O(n log n), making it more suitable for large lists. Please let me know which implementation you'd like to use or any further optimizations you'd like me to explore.
Related benchmarks:
Unique via Set vs Filter
includes sorted vs unsorted
spread vs concat vs unshift Big string array
Javascript switch vs dict
Comments
Confirm delete:
Do you really want to delete benchmark?