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.
"Not today" can be boredom, burnout, lack of appreciation, frustration, distraction, hatred (user/bosses/hardware/software/lang/tools/industry), motivation, laziness or just needed.
- Start anyway. Just a tiny item.
- Push through. Do it no matter what.
- Cause pressure/stress. It has to be done.
- Cancel the day, reward yourself no guilt & then ban the next 5 'not todays'.
- Do physical activity. Release.
- Do mental activity.
- Fill up with inspiration (see things, look at things, study things).
- Do something else (distract, detoxic, grow).
- Change roles/projects/job/title/skills/industry.
- Do it for someone you care about (whatever it is & whoever someone is).
- Set goals. Small or large but achievable.
- Publish stuff (build your brand/network/skills/whatever).
- Play games. Call it 'research'.
- Have a cause or purpose.
- Engage with people you like.
- Sleep. Eat.
- Screen Staremode (can work).
- Stimulation (lights/audio/sugar/caffiene/nicotine etc).
- Break something (that causes urgency to your mind).
- Check meds (if relevant).
- Don't worry about it unless there are lots of days in a row or it becomes regular.
Any, none or all of the above depending on the person I guess.
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.
"art built on top of logic" is probably one of the best descriptions i ever read.
Oh, also you can get more bang for your buck...
if you use
Becasue... Size matters 😜, and so does security 🔒
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 ✌