Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Filter vs Filter and Compact
(version: 0)
Comparing performance of:
Filter vs Filter and Compact
Created:
4 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
var arr = [{ "id": 1, "first_name": "Averell", "last_name": "Davitt", "email": "adavitt0@pinterest.com", "gender": "Male", "ip_address": "179.7.120.55" }, { "id": 2, "first_name": "Muhammad", "last_name": "Townson", "email": "mtownson1@telegraph.co.uk", "gender": "Male", "ip_address": "147.80.52.15" }, { "id": 3, "first_name": "Victoria", "last_name": "Ginner", "email": "vginner2@wikimedia.org", "gender": "Genderqueer", "ip_address": "136.174.73.218" }, { "id": 4, "first_name": "Oliver", "last_name": "Lamdin", "email": "olamdin3@wordpress.org", "gender": "Male", "ip_address": "153.124.229.239" }, { "id": 5, "first_name": "Enrichetta", "last_name": "Longfield", "email": "elongfield4@hud.gov", "gender": "Bigender", "ip_address": "229.59.173.235" }, { "id": 6, "first_name": "Parker", "last_name": "Towlson", "email": "ptowlson5@irs.gov", "gender": "Male", "ip_address": "40.57.44.151" }, { "id": 7, "first_name": "Kara", "last_name": "Walaron", "email": "kwalaron6@accuweather.com", "gender": "Female", "ip_address": "61.82.62.251" }, { "id": 8, "first_name": "Vinnie", "last_name": "Tape", "email": "vtape7@jugem.jp", "gender": "Male", "ip_address": "169.203.89.141" }, { "id": 9, "first_name": "Cleveland", "last_name": "Dorber", "email": "cdorber8@wunderground.com", "gender": "Male", "ip_address": "59.123.125.215" }, { "id": 10, "first_name": "Sarita", "last_name": "Gleave", "email": "sgleave9@epa.gov", "gender": "Female", "ip_address": "100.23.157.210" }, { "id": 11, "first_name": "Robinia", "last_name": "Garrelts", "email": "rgarreltsa@baidu.com", "gender": "Female", "ip_address": "68.50.17.99" }, { "id": 12, "first_name": "Gustavo", "last_name": "Dalwood", "email": "gdalwoodb@nifty.com", "gender": "Male", "ip_address": "24.78.52.192" }, { "id": 13, "first_name": "Adel", "last_name": "Muehle", "email": "amuehlec@netlog.com", "gender": "Bigender", "ip_address": "76.215.149.249" }, { "id": 14, "first_name": "Aimil", "last_name": "Longwood", "email": "alongwoodd@webeden.co.uk", "gender": "Female", "ip_address": "213.103.239.125" }, { "id": 15, "first_name": "Thatcher", "last_name": "Crease", "email": "tcreasee@nbcnews.com", "gender": "Male", "ip_address": "44.252.236.237" }, { "id": 16, "first_name": "Malory", "last_name": "Robjant", "email": "mrobjantf@angelfire.com", "gender": "Genderqueer", "ip_address": "143.95.91.2" }, { "id": 17, "first_name": "Carleton", "last_name": "Ruddom", "email": "cruddomg@geocities.com", "gender": "Genderqueer", "ip_address": "215.196.250.204" }, { "id": 18, "first_name": "Meridel", "last_name": "Enga", "email": "mengah@microsoft.com", "gender": "Female", "ip_address": "126.55.232.55" }, { "id": 19, "first_name": "April", "last_name": "Gandrich", "email": "agandrichi@aol.com", "gender": "Genderqueer", "ip_address": "14.22.35.47" }, { "id": 20, "first_name": "Idaline", "last_name": "Kasperski", "email": "ikasperskij@oaic.gov.au", "gender": "Agender", "ip_address": "253.230.20.139" }, { "id": 21, "first_name": "Wilden", "last_name": "Werndley", "email": "wwerndleyk@infoseek.co.jp", "gender": "Male", "ip_address": "107.42.238.245" }, { "id": 22, "first_name": "Sheeree", "last_name": "Simmgen", "email": "ssimmgenl@furl.net", "gender": "Female", "ip_address": "78.228.45.244" }, { "id": 23, "first_name": "Brander", "last_name": "Hooks", "email": "bhooksm@cloudflare.com", "gender": "Male", "ip_address": "63.241.51.237" }, { "id": 24, "first_name": "Ashly", "last_name": "Leadbeatter", "email": "aleadbeattern@wiley.com", "gender": "Female", "ip_address": "108.119.74.16" }, { "id": 25, "first_name": "Pace", "last_name": "Colam", "email": "pcolamo@cnn.com", "gender": "Male", "ip_address": "159.221.200.77" }, { "id": 26, "first_name": "Crin", "last_name": "Clohissy", "email": "cclohissyp@elegantthemes.com", "gender": "Female", "ip_address": "89.159.35.127" }, { "id": 27, "first_name": "Gardiner", "last_name": "Yanuk", "email": "gyanukq@liveinternet.ru", "gender": "Male", "ip_address": "117.196.242.126" }, { "id": 28, "first_name": "Mark", "last_name": "Heyward", "email": "mheywardr@tamu.edu", "gender": "Male", "ip_address": "133.117.185.235" }, { "id": 29, "first_name": "Sanford", "last_name": "Atto", "email": "sattos@opera.com", "gender": "Genderfluid", "ip_address": "240.131.114.111" }, { "id": 30, "first_name": "Edward", "last_name": "Khidr", "email": "ekhidrt@reddit.com", "gender": "Male", "ip_address": "109.163.27.16" }, { "id": 31, "first_name": "Terry", "last_name": "Storrs", "email": "tstorrsu@ox.ac.uk", "gender": "Genderfluid", "ip_address": "245.135.10.2" }, { "id": 32, "first_name": "Giff", "last_name": "Filyukov", "email": "gfilyukovv@trellian.com", "gender": "Polygender", "ip_address": "172.141.187.112" }, { "id": 33, "first_name": "Martainn", "last_name": "Perello", "email": "mperellow@blogs.com", "gender": "Male", "ip_address": "68.254.126.62" }, { "id": 34, "first_name": "Lesley", "last_name": "Balling", "email": "lballingx@ca.gov", "gender": "Male", "ip_address": "30.108.0.52" }, { "id": 35, "first_name": "Arne", "last_name": "McAviy", "email": "amcaviyy@weather.com", "gender": "Male", "ip_address": "232.161.16.18" }, { "id": 36, "first_name": "Marylynne", "last_name": "Keene", "email": "mkeenez@odnoklassniki.ru", "gender": "Female", "ip_address": "86.141.4.64" }, { "id": 37, "first_name": "Dyna", "last_name": "Cranstone", "email": "dcranstone10@plala.or.jp", "gender": "Female", "ip_address": "21.129.94.67" }, { "id": 38, "first_name": "Clarissa", "last_name": "Brownbridge", "email": "cbrownbridge11@fda.gov", "gender": "Female", "ip_address": "229.232.213.225" }, { "id": 39, "first_name": "Bartholomeus", "last_name": "Albery", "email": "balbery12@addthis.com", "gender": "Male", "ip_address": "92.120.14.242" }, { "id": 40, "first_name": "Camille", "last_name": "Pietsma", "email": "cpietsma13@wp.com", "gender": "Female", "ip_address": "145.250.109.164" }, { "id": 41, "first_name": "Cherish", "last_name": "Biskupiak", "email": "cbiskupiak14@jalbum.net", "gender": "Female", "ip_address": "114.104.166.204" }, { "id": 42, "first_name": "Mal", "last_name": "Stern", "email": "mstern15@about.me", "gender": "Male", "ip_address": "143.217.210.57" }, { "id": 43, "first_name": "Rickert", "last_name": "Dorbin", "email": "rdorbin16@umn.edu", "gender": "Genderfluid", "ip_address": "49.2.157.244" }, { "id": 44, "first_name": "Bucky", "last_name": "Wolton", "email": "bwolton17@narod.ru", "gender": "Genderfluid", "ip_address": "74.102.75.218" }, { "id": 45, "first_name": "Gennifer", "last_name": "Etteridge", "email": "getteridge18@blogs.com", "gender": "Female", "ip_address": "204.58.84.159" }, { "id": 46, "first_name": "Grantham", "last_name": "Ballam", "email": "gballam19@tripadvisor.com", "gender": "Male", "ip_address": "13.97.238.166" }, { "id": 47, "first_name": "Hetti", "last_name": "Dodgshun", "email": "hdodgshun1a@de.vu", "gender": "Female", "ip_address": "252.215.111.11" }, { "id": 48, "first_name": "Avery", "last_name": "Stredder", "email": "astredder1b@phpbb.com", "gender": "Male", "ip_address": "194.10.1.207" }, { "id": 49, "first_name": "Jonah", "last_name": "Fotheringham", "email": "jfotheringham1c@disqus.com", "gender": "Male", "ip_address": "72.9.26.200" }, { "id": 50, "first_name": "Danny", "last_name": "Poole", "email": "dpoole1d@nps.gov", "gender": "Female", "ip_address": "117.196.22.15" }]
Tests:
Filter
var filteredData = _.filter(arr, item => { return item })
Filter and Compact
var filteredData = _.filter(arr, item => { return item }) filteredData = _.compact(filteredData)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Filter
Filter and Compact
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):
I'll do my best to extract relevant information from the provided JSON data and benchmark results. **Individual Test Cases:** Based on the JSON data, I can identify 50 individuals with their first name, last name, email, gender, and IP address. Here are the test cases: 1. Filter: * Remove all empty objects from the array (since they have no `id`, `first_name`, or `last_name` properties) 2. Filter and Compact: * Apply the same filtering as above * Then, remove any null values from the filtered data **Latest Benchmark Result:** The benchmark results show that there are two test cases: 1. "Filter" * Raw UA string: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0 * Browser: Firefox 99 * DevicePlatform: Desktop * OperatingSystem: Windows * ExecutionsPerSecond: 1643998.875 * TestName: Filter 2. "Filter and Compact" * Raw UA string: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0 * Browser: Firefox 99 * DevicePlatform: Desktop * OperatingSystem: Windows * ExecutionsPerSecond: 785287.375 * TestName: Filter and Compact Let me know if you'd like me to help with anything else!
Related benchmarks:
Native filter vs lodash find
lodash vs es6 in filter method
splice + spread vs filter to remove one item at given index
spread + splice vs filter to remove one item at given index
Comments
Confirm delete:
Do you really want to delete benchmark?