3 ms·
> You could probably improve the above by using an interface rather than a bool to reduce the memory impact. If you need a function that preserves the order tha
by ssd532 3y ago
> You could probably improve the above by using an interface rather than a bool to reduce the memory impact. If you need a function that preserves the order that might be a better implementation.
An empty interface occupies 16 bytes. Perhaps the author meant an empty struct which consumes nothing.
- Cthulhu_ 3y agoIt's weird, I've heard of the author plenty of times (and frequently use https://github.com/boyter/scc https://github.com/boyter/scc), I would've thought they knew about using an empty interface to emulate a set with no overhead in Go.
- boyter 3y agoThat’s what I get for turning throwaway slack posts into blog posts without looking over it. Didn’t expect it to end up being read. It was more “I wrote this on slack I should save a copy”. Indeed should be struct for lower overhead. I’ll fix it tomorrow once my ego recovers from the inevitable comments that suggest I should give up programming and never write any technical post again.
- timmy777 3y agoSorry, the internet is full of people with low empathy. Mistakes on internet are corrected in very harsh ways, and many times rarely forgiven. But hey, keep writing, keep learning, keep reflecting and taking feedbacks to improve. Everyone does this
- ssd532 3y agoI appreciate the effort you've put into sharing your learnings. My intention was not to criticize. I just wanted to point it out for everyone's benefit. I apologize if my comment came across as harsh.
- boyter 3y agoNot at all. I annoyed the fediverse a while back and that was what I would call harsh. Well that and some reddit comments. I actually appreciate comments like yours. I did indeed make a mistake. Just as mentioned never intended this post to end up here. Hence the spelling errors and problems like this.
- ssd532 3y agoBTW thanks for scc. Got to know from the other comment that you are the author. I use it on my solo projects to get sense of how much work I am actaully doing.
- boyter 3y agoI look forward to the beating I get when I update it to have accurate gitignore file processing and the post about doing that!
- avg_dev 3y agoFWIW, I’ve taken some concrete lessons away from this post and the ensuing discussion.
- deleted 3y ago[deleted]