This is a weekly roundup of awesome DEV comments that you may have missed. You are welcome and encouraged to boost posts and comments yourself using the #bestofdev tag.
Answering What do you do when you don't feel productive?, @vuild provides a great list of todos for those moments when you feel like you just don't want to do anything:
@jadebeer adds on to the 10 Things Every Software Developer Should Know list with an oftentimes overlooked aspect of being effective on teams:
The one thing almost nobody ever focuses on is: people skills.
Learn how to work in teams, learn how to communicate. Learn what makes you tick and how to respectfully communicate that. Become acquainted with your strengths and weaknesses (yeah we all have some) and how this can contribute to your team's success and your growth.
We don't work in solitude - almost all ventures consist of teams. And if you do happen to be a one-person coding machine, you need to be better than ever dealing with people if you hope to understand your users and sell your product.
Invest in your soft skills, build your relationships. Make being a people's person part of your personal brand.
@lucagrandicelli plucks out a choice quote from @erikaheidi's wonderful article The Art of Programming:
"art built on top of logic" is probably one of the best descriptions i ever read.
In Docker For Frontend Developers, @derek follows up with a quick note about size and security:
Oh, also you can get more bang for your buck...
if you use
FROM node:8-alpine
or
FROM gcr.io/distroless/nodejs
Becasue... Size matters 😜, and so does security 🔒
Image | Size |
---|---|
node:8 | 681MB |
gcr.io/distroless/nodejs | 76MB |
node:8-alpine | 69.7MB |
@mortoray joins the conversation in Javascript Array.push is 945x faster than Array.concat 🤯🤔 to provide further analysis and context about the complexity of what's going on:
Nice investigation.
The concat loop is akin to O(n^2) whereas the push loop is O(n). By creating a new array you need to do the copy, as you showed. This happens for every iteration of the loop*. An array push however is amortized constant time (usually), thus you only copy each element once (well probably three times).
Part of the issue with increased copying is the increased memory access. Your array probably exceeds the bounds of the L0 cache on the CPU, possibly the L1 cache. This means that when concat copies, it needs to load new memory from a more distant cache, repeatedly. The push version never accesses the data already in the list, thus avoiding this extra memory loading.
(*Before somebody gets pedantic, it's more like a K*N loop, where K is the loop iterations. Hwever, since the size of the resulting array is linearly related to K, it means c * K = N
, thus ~ N^2)
See you next week for more great comments ✌
"Not today" can be boredom, burnout, lack of appreciation, frustration, distraction, hatred (user/bosses/hardware/software/lang/tools/industry), motivation, laziness or just needed.
Any, none or all of the above depending on the person I guess.