Readit News logoReadit News
dominicrose commented on Patterns.dev   patterns.dev/... · Posted by u/handfuloflight
css_apologist · 5 days ago
I've used these things. IME, nowadays it's not worth the bundle size to bring in these libraries. map/filter seems quite optimized, {...obj} is fast since its only shallow. Yes it does come down to practices vs better libraries, but in practice, it's fine IME

One thing to note, i was very excited that we have a bunch of lazy methods on Iterator protocol, but they are slow as shit as of earlier this year.

I wrote a parser a year ago with extreme use of .map (every step of processing was cloning the tokens), and i thought, let's migrate it to lazy iterator - it got ~10x slower :(. The compile time was fine for my use cases, so i didn't give immutable-js a try, but it was a surprise

I did some benchmarks on map+filter vs mutable for of + push, and on firefox up to 200-300 elements map+filter is actually faster (unforunately not on chrome).

Of course, its not the best, but my experience is that modern js engines are fast enough for most use cases to not have to bring in any libraries anymore

dominicrose · 15 hours ago
I think the goal of lazy iterations is to make less iterations, not to make iterations themselves faster.
dominicrose commented on JSDoc is TypeScript   culi.bearblog.dev/jsdoc-i... · Posted by u/culi
dzonga · a day ago
are dynamic languages really a "use at your own risk" ? or it's about changing frame of mind ?

my take is if you treat your program as a series of data flows - then use primitives such as maps | arrays - then you don't need as much typing or typing at all. a map doesn't need to take a shape or a Person | Manager - either the keys exist or they don't and almost every language has guards to ensure you can safely navigate existence of keys.

but then again my realm is mostly around - web | data systems - if I was dealing with OS level systems and needed to make sure i have i64 ints then yeah typing would be crucial.

dominicrose · 15 hours ago
Well we take risks in either direction. The risk of using Java is becoming bored to death and having delays. The risk of PHP is that you know bugs are going to happen in production, even if you have something like Sentry to monitor them, even if they're not critical bugs.
dominicrose commented on Secret Documents Show Pepsi and Walmart Colluded to Raise Food Prices   thebignewsletter.com/p/se... · Posted by u/connor11528
dominicrose · 15 hours ago
As if we needed another reason not to buy junk food. By the way, in France we have a 5.5% VAT on food, instead of 20% for other products. Junk food is also 5.5% but cat food is 20%. I wonder if this is going to change some day for junk food or sodas.
dominicrose commented on The appropriate amount of effort is zero   expandingawareness.org/bl... · Posted by u/gmays
harrall · a day ago
Reminds me of when I first tried to learn guitar. I tried doing fingering practices. It was so boring. I gave up after like a week.

I thought that playing music just wasn’t for me.

Many years later, I picked up a friend’s guitar next to me and just tried to play one of my favorite songs just by ear. I got enough right that it was fun and I got hooked.

dominicrose · 15 hours ago
I like repeating something someone else created until I master it. Playing just a little bit better after every attempt is motivating, playing well after training is also motivating.

Creating is not motivating because I compare myself to others. You have to feel that you could do something unique enough or good enough to be motivated.

Electric guitar can be really fun but I always end up playing the piano because it's easier. The keys are in order in front of you, not arranged in weird ways on strings.

dominicrose commented on The appropriate amount of effort is zero   expandingawareness.org/bl... · Posted by u/gmays
saulpw · a day ago
After you've spent a lot of time exerting yourself, then you can let go and let your non-doing take over. I've experienced this myself with coding and music and language. Once you've got it "in your fingers", learning to relax is a big part of the Inner Game of Whatever.

But don't tell me that Katie Ledecky didn't put in a huge amount of effort in her training before her world-class swimming performances. That's a lie, guaranteed to mislead many people to not trying anything because it feels like effort.

dominicrose · 16 hours ago
Yes the expert brain anticipates and thus can be more relaxed. Music doesn't sound good until it's effortless, because trying hard is hearable.
dominicrose commented on JSDoc is TypeScript   culi.bearblog.dev/jsdoc-i... · Posted by u/culi
Waterluvian · 2 days ago
A few things I've come to personally believe after spending years developing web and robotics software in Python/JavaScript then spending years having to maintain while constantly adding new features and dealing with company pivots:

- The types exist whether you write them down or not.

- If they're not written down, they're written down in your head.

- Your head is very volatile and hard for others to access.

- Typing is an incredibly good form of documentation.

- JSDoc and TypeScript are standards/formats for typing. Like any tools, they both have advantages and disadvantages. Neither is objectively better than the other.

- Make informed decisions on how you'll describe your types, and then be consistent and unsurprising.

- A type checker is the computer saying, "okay then, prove it" about your program's type validity.

- Not every program benefits from the same amount of "prove it."

- Too much can be as bad as too little. You're wasting resources proving throwaway code.

- I like languages that let you decide how much you need to "prove it."

dominicrose · 2 days ago
> The types exist whether you write them down or not

That's easy to say when we're talking about primitive arguments in private functions, or primitive local variables, but let's not ignore the fact that it takes much more work to write a C# program than a Ruby program for instance.

We can see that by looking at a vanillajs library's typescript typings that were created after the js library when typescript didn't exist. The types are insanely complex and if you get one type wrong you can break compilation of some library user's program (its happened to me).

That being said I'm aware that dynamic programming languages are a "use at your own risk" type of language.

dominicrose commented on Patterns.dev   patterns.dev/... · Posted by u/handfuloflight
css_apologist · 6 days ago
this site reads like its 2017

its low quality, breadth but no depth

more important is to deeply understand the basics of working with immutable data. try writing applications with no for loops or forEach (and actually use the array methods as they are intended), no cloneDeep hacks and obviously no direct property mutation, always create a new object.

in real world you still use for loops plenty, but as a junior its good to see what its like to live without it for a while.

dominicrose · 6 days ago
I've used Clojure/Script in the past and it's good to enforce working with immutable data.

Immutable.js has similar data structures but it's not the standard way of doing things and uglier to debug.

Using standard objects, immutability is not enforced in JS and throwing a few Object.freeze calls won't change that so we lose half the benefits that Clojure would bring: parallel/concurrent programming benefits, easier deep equality checks, performance...

If the code is not performance sensitive and can run in a single thread, simply "not mutating some of the mutable data" is a start for someone interested in immutability. That's what ramdajs does, it doesn't invent new data structures or freeze objects but simply returns new ones.

Only a few functions from ramdajs are actually useful in 2025 since JS has evolved with things like array/object destructuring and "..." but in any case it's an inspiring library.

dominicrose commented on Horses: AI progress is steady. Human equivalence is sudden   andyljones.com/posts/hors... · Posted by u/pbui
mark242 · 8 days ago
Someone who makes horseshoes then learns how to make carburetors, because the demand is 10x.

https://en.wikipedia.org/wiki/Jevons_paradox

dominicrose · 8 days ago
> Governments have typically expected efficiency gains to lower resource consumption, rather than anticipating possible increases due to the Jevons paradox

I think that it's true that governments want the efficiency gains but it's false that they don't anticipate the consumption increases. Nobody is spending trillions on datacenters without knowing that demand will increase, that doesn't mean we shouldn't make them efficient.

dominicrose commented on Horses: AI progress is steady. Human equivalence is sudden   andyljones.com/posts/hors... · Posted by u/pbui
YmiYugy · 8 days ago
To stay within the engine analogy. We have engines that are more powerful than horses, but

1. we aren’t good at building cars yet,

2. they break down so often that using horses often still ends up faster,

3. we have dirt tracks and feed stations for horses but have few paved roads and are not producing enough gasoline.

dominicrose · 8 days ago
yes and the question is do horses have 20 years or less i.e. 5 years?
dominicrose commented on Horses: AI progress is steady. Human equivalence is sudden   andyljones.com/posts/hors... · Posted by u/pbui
zwnow · 8 days ago
The goal is to eradicate the common man. Turns out you dont need a lot of energy, food, water, space if there aren't 8 billion humans to supply. It's the tech billionaires dream, replacing humans with robotic servants. Corporations do not care about the common man.
dominicrose · 8 days ago
Full robotic servants are very costly, only AI servants are cheap enough. But I do think we're going to see more wars and robotic use in wars.

u/dominicrose

KarmaCake day171May 9, 2021View Original