remove hasOwnProperty call by gurgunday · Pull Request #183 · jshttp/cookie
Before:
name hz min max mean p75 p99 p995 p999 rme samples
· simple 9,536,666.74 0.0000 1.9262 0.0001 0.0001 0.0001 0.0002 0.0003 ±1.15% 4768334 fastest
· decode 4,351,025.10 0.0001 0.1439 0.0002 0.0003 0.0003 0.0003 0.0004 ±0.11% 2175513
· unquote 8,798,691.91 0.0000 3.5239 0.0001 0.0001 0.0002 0.0002 0.0003 ±1.60% 4399346
· duplicates 1,870,817.76 0.0004 0.1379 0.0005 0.0005 0.0007 0.0008 0.0025 ±0.11% 935409
· 10 cookies 725,326.87 0.0012 0.2622 0.0014 0.0014 0.0016 0.0018 0.0047 ±0.43% 362664
· 100 cookies 64,256.19 0.0141 0.2938 0.0156 0.0153 0.0211 0.0258 0.1795 ±0.55% 32129 slowest
✓ parse top-sites (20) 30438ms
name hz min max mean p75 p99 p995 p999 rme samples
· parse accounts.google.com 7,973,679.12 0.0000 3.5668 0.0001 0.0001 0.0002 0.0002 0.0003 ±1.40% 3986840
· parse amazon.com 2,524,065.60 0.0002 2.8802 0.0004 0.0004 0.0005 0.0005 0.0010 ±1.17% 1262033
· parse apple.com 8,738,064.27 0.0000 0.2993 0.0001 0.0001 0.0001 0.0002 0.0003 ±0.78% 4369033
· parse cloudflare.com 7,969,211.55 0.0000 0.4134 0.0001 0.0001 0.0002 0.0002 0.0004 ±0.76% 3984606
· parse docs.google.com 8,069,740.05 0.0000 0.0374 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.07% 4034871
· parse drive.google.com 7,891,565.75 0.0000 0.0435 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.07% 3945783
· parse en.wikipedia.org 2,029,437.43 0.0004 0.3934 0.0005 0.0005 0.0006 0.0007 0.0008 ±0.24% 1014719
· parse istockphoto.com 411,196.45 0.0022 0.5065 0.0024 0.0024 0.0028 0.0031 0.0075 ±0.71% 205599 slowest
· parse maps.google.com 7,976,809.60 0.0000 0.6668 0.0001 0.0001 0.0002 0.0002 0.0004 ±0.90% 3988405
· parse play.google.com 7,898,624.74 0.0000 0.4017 0.0001 0.0001 0.0002 0.0002 0.0005 ±0.79% 3949313
· parse policies.google.com 7,843,192.89 0.0000 0.4424 0.0001 0.0001 0.0002 0.0002 0.0005 ±1.01% 3921597
· parse pt.wikipedia.org 2,416,569.74 0.0003 0.0569 0.0004 0.0004 0.0005 0.0005 0.0006 ±0.08% 1208285
· parse sites.google.com 7,973,319.04 0.0000 0.0571 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.08% 3986660
· parse support.google.com 4,496,789.40 0.0001 0.6247 0.0002 0.0002 0.0003 0.0003 0.0006 ±1.28% 2248395
· parse t.me 7,887,270.60 0.0000 2.3432 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.92% 3943636
· parse vk.com 856,894.20 0.0010 0.3931 0.0012 0.0012 0.0014 0.0015 0.0044 ±0.54% 428448
· parse www.google.com 4,694,536.25 0.0001 0.4127 0.0002 0.0002 0.0003 0.0003 0.0005 ±0.67% 2347269
· parse youtu.be 1,806,772.16 0.0004 0.0569 0.0006 0.0005 0.0007 0.0007 0.0008 ±0.08% 903389
· parse youtube.com 1,713,205.32 0.0004 0.0720 0.0006 0.0006 0.0007 0.0008 0.0010 ±0.10% 856603
· parse example.com 21,520,975.05 0.0000 0.0454 0.0000 0.0000 0.0001 0.0001 0.0001 ±0.07% 10760488 fastest
After:
name hz min max mean p75 p99 p995 p999 rme samples
· simple 9,375,902.65 0.0000 2.1365 0.0001 0.0001 0.0001 0.0002 0.0003 ±1.26% 4687952 fastest
· decode 4,361,141.90 0.0001 0.0906 0.0002 0.0003 0.0003 0.0003 0.0004 ±0.09% 2180571
· unquote 9,053,984.48 0.0000 0.3696 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.50% 4526993
· duplicates 1,899,611.85 0.0004 0.2430 0.0005 0.0005 0.0007 0.0007 0.0008 ±0.16% 949806
· 10 cookies 733,253.49 0.0011 0.4528 0.0014 0.0013 0.0017 0.0019 0.0058 ±0.78% 366627
· 100 cookies 67,354.93 0.0131 0.4508 0.0148 0.0144 0.0203 0.0268 0.3113 ±0.92% 33678 slowest
✓ parse top-sites (20) 30506ms
name hz min max mean p75 p99 p995 p999 rme samples
· parse accounts.google.com 8,168,533.30 0.0000 0.3649 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.16% 4084267
· parse amazon.com 2,504,860.65 0.0003 0.5039 0.0004 0.0004 0.0005 0.0005 0.0010 ±0.72% 1252431
· parse apple.com 8,366,634.68 0.0000 0.7055 0.0001 0.0001 0.0002 0.0002 0.0003 ±1.40% 4183318
· parse cloudflare.com 7,707,217.48 0.0000 0.3580 0.0001 0.0001 0.0002 0.0002 0.0005 ±0.76% 3853609
· parse docs.google.com 8,066,836.08 0.0000 0.0425 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.08% 4033419
· parse drive.google.com 8,190,201.41 0.0000 0.0496 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.08% 4095101
· parse en.wikipedia.org 2,032,568.20 0.0004 0.4090 0.0005 0.0005 0.0006 0.0006 0.0008 ±0.34% 1016285
· parse istockphoto.com 401,386.78 0.0022 0.5097 0.0025 0.0025 0.0028 0.0032 0.0085 ±0.69% 200694 slowest
· parse maps.google.com 7,883,794.32 0.0000 0.4968 0.0001 0.0001 0.0002 0.0002 0.0005 ±0.92% 3941919
· parse play.google.com 7,938,028.54 0.0000 0.3647 0.0001 0.0001 0.0002 0.0002 0.0004 ±0.70% 3969015
· parse policies.google.com 7,803,352.49 0.0000 0.4558 0.0001 0.0001 0.0002 0.0002 0.0005 ±1.04% 3901677
· parse pt.wikipedia.org 2,416,136.80 0.0003 0.0569 0.0004 0.0004 0.0005 0.0005 0.0006 ±0.12% 1208069
· parse sites.google.com 8,140,285.53 0.0000 0.1084 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.08% 4070143
· parse support.google.com 4,467,599.83 0.0001 9.2805 0.0002 0.0002 0.0003 0.0003 0.0006 ±3.84% 2233800
· parse t.me 8,063,400.15 0.0000 2.9553 0.0001 0.0001 0.0002 0.0002 0.0003 ±1.16% 4031701
· parse vk.com 838,286.50 0.0010 2.7789 0.0012 0.0012 0.0014 0.0016 0.0048 ±1.13% 419144
· parse www.google.com 4,756,138.03 0.0001 1.8527 0.0002 0.0002 0.0003 0.0003 0.0005 ±0.98% 2378171
· parse youtu.be 1,851,767.07 0.0004 0.3175 0.0005 0.0005 0.0006 0.0007 0.0008 ±0.16% 925884
· parse youtube.com 1,851,129.30 0.0004 0.3191 0.0005 0.0005 0.0007 0.0007 0.0008 ±0.15% 925565
· parse example.com 21,308,312.47 0.0000 0.0374 0.0000 0.0000 0.0001 0.0001 0.0001 ±0.08% 10654157 fastest
It still appears indifferent for me using node v22.9.0. I also found this site: https://andrew.hedges.name/experiments/in/. It seems like hasOwnProperty is faster for me on Safari and slower on Chrome 🤷 Maybe it's our different node/v8 versions?
Edit: Either way I'm good with using undefined, just wanted to update the benchmarks I have.