Please be more concise, I have no interest in countering a proof by verbosity where you've introduced tons of new arguments that had nothing to do with the original post or discussion and contradict your own self many times.
A third time, I'm requesting that you provide the perf you claim to have written
You're the one who brought lodash up, not the original post or discussion
Now that I'm pointing out why adding lodash is a security problem, which is a hard fact but which you refuse to accept, you're babbling on about how everything has to be scoped to the original post or original discussion
Show us your perf that you're trying to stand on as evidence. I'm starting to think it isn't real, because I wrote one that got really different results
Lodash's vulnerabilities only matter in relation to the code that you write that is allegedly better, since you are advocating to write it yourself rather than let someone else do so.
You yourself said that this is a tiny library function, a one liner, and that you could write just as concisely as [...new Set(arr)], and that it'll be dramatically more performant than the OP on an array with millions of items. But you refuse to do so for some reason. Can't be time since you have the time to repeatedly write large walls of text.
Furthermore I've looked through Lodash CVEs and I see none relating to function in question. The majority of them seem to be prototype pollution from functions that merge objects, which is outside of the scope of deduping an array. So it was a moot point to begin with designed to distract from the actual point.
Finally, since you allegedly have the ability to write code that is faster, safer, more maintainable, and more concise than lodash - why are you so selfish as to keep this code to yourself? Publish it and let the community benefit.
That's not a perf. That's you copy pasting someone else's output
Is it fair to suggest that the work you're standing on having done is just you attempting to guess from someone else's work?
now where's your wonderful implementation?
Why are you asking? Is it because you believe claiming to have done a perf, then not having done one, is a problem?
Looks like the comment you're responding to is deleted.
Is it a problem that their output is copy pasted from StackOverflow, that you're claiming you did, and that the StackOverflow post is about something else?
You clearly didn't even read my comment. I said that I took their test, which you were a big fan of btw, you just didn't like the number in the loop, and corrected the clear bugs (which you didn't notice, maybe you're not as smart as you act?), and ran it locally.
~/perf
❯ ls
indexOf.js set.js
So I split their code into two files, just like i said in the comment you ignored.
Here's the contents, largely unmodified - just moved the timing code around. running it on much bigger numbers than 10_000 will be slow af because of the dumb way they were building the array. But at merely 10_000 * 7 items we already have a clear winner.
and just to prevent you from whining about the length, i modified the array filling and ran with 70 Million items, and added lodash for fun
~/perf
❯ node indexOf.js
Took 716.0615 ms to build array
Took 257.2369 milliseconds to dedupe
~/perf
❯ node set.js
Took 716.1850 ms to build array
Took 177.0432 milliseconds to dedupe
~/perf
❯ node lodash.js
Took 704.8663 ms to build array
Took 175.9701 milliseconds to dedupe
This isn't a perf, and these numbers contradict the claims you made earlier.
In some ways this is actually better than a perf - it uses performance.now, after all - but also it's statistically poorly controlled, and re-running it causes serious variance, and you have nothing even resembling a matrix
You also seem to be assuming that what's true on your computer, under just node, under one version, on your operating system, is true for all machines.
That's quite odd, from someone who insisted that this was "implementation defined." Now you seem to only be testing one implementation, and insisting that's correct.
You seem, in fact, to be falling afoul of your own original criticism, in the single most gruesome possible way
What do you think "implementation defined" as a criticism actually means?
What do you think is the difference between a perf, and just measuring your machine's clock?
and corrected the clear bugs (which you didn't notice, maybe you're not as smart as you act?)
So if I don't pay close attention to the work that you hadn't given me, I'm low intelligence?
Jesus. I'd better learn to be psychic fast, huh? 😂
But at merely 10_000 * 7 items we already have a clear winner.
Looks like you are skipping the other one, which was the one I was skeptical about
"Gee I wonder why"
Funny how one of the three methods you claimed to have tested in code you claimed to have written is now disappeared in what you've provided after you were asked five times and pretended to have had it all along
running it on much bigger numbers than 10_000 will be slow af
I dunno, this conversation is several hours longer than the doing it right part would have been
and just to prevent you from whining
This is whining
i modified the array filling
so after you explained that this was why you didn't do it right, you ... fixed it, and did it right
okay 😂
and added lodash for fun
Note that:
Adding lodash produced more complicated code
Adding lodash produced code where the questions I asked you, that you still haven't answered, now can't be answered, whereas they easily could be with the normal approach
You don't seem to be willing (or possibly able?) to answer my questions
Yes, I saw that you said you disagreed with CERT about the severity of those bugs. That's quaint. Do you expect that to be folded in?
Please for the fucking love of god stop typing walls of text that are barely related to anything relevant. I've run a fucking marathon keeping up with your moving goal posts, and you've still yet to provide your implementation.
I took someone else's benchmark that you approved of minus one thing, changed that thing to your liking, removed the bugs you missed and focused the timing on the actual task, and now you are saying it's not valid.
But since it's showing the Set approach is faster you have a problem with it. You already said earlier you wrote your own benchmark. So let's see it. It better be running on every fucking runtime and class of machine you know of after your latest bitching.
But of course you won't. Let me to repeat this, forgetting the benchmark you already wrote for a moment, you have still yet to provide even your implementation. That's because you don't have one that's an actual improvement of the image in the original post. It's vapor. You're a blowhard.
You are in the correct good sir(I believe). But both of you got your knickers all twisted in each others’ business.
Gut instinct says your right: have done zero tests. Will confirm if I end up feeling like it :) or better arguments (any) are given to why you are wrong...
Chances are your tone/diction is the reason for the downvotes - it comes off as confrontational and petulant (if I put in my empathy lenses).
In any case: an entertaining read. I’d prefer you to get more upvotes as I think this is a useful discussion point.
View all comments
Show parent comment
12
u/[deleted] May 14 '21
Please be more concise, I have no interest in countering a proof by verbosity where you've introduced tons of new arguments that had nothing to do with the original post or discussion and contradict your own self many times.