5
jestdotty
68d

welp I went from "gosh rust makes programming so stupid because I don't have to keep anything in my head like in JavaScript, if it compiles it runs zzzz you can literally be wasted / in dementia and write working software now"

to "I wonder if I can inspect how long threads are waiting for mutex locks to squeeze the hell out of performance"

new code golf

Comments
  • 3
    Just time the moment before locking, in locking, add to variable while mutex locked and increment how many times you locked and you have an average. But you need nanoseconds for that. Nanoseconds in C is a bit different stdlib wise, don't know for rust.

    Compiled language feels more decent huh? With scripts I always doubt a bit if I didn't accidently changed smth after the testing
  • 4
    Not having to keep everything in your head doesn’t make it stupid. It makes it sane.

    Do js developers have some kind of superiority complex because they feel great when they don’t fuck up the code first try?
  • 3
    @Lensflare it's the most extreme case of stockholm syndrome i've ever seen in tech.
  • 2
    @tosensei I thought there was some Dunning-Kruger going on as well.
  • 2
    @jestdotty so you equate thinking with keeping shit in your head. That’s obviously wrong.

    I find thinking enjoyable too. In fact that’s the reason why I love coding. I love thinking really hard about how to solve a problem in the best way and how to come up with a good code structure or system for that.

    But since you have a very different definition of thinking, I wonder what the heck it is that you enjoy. Is it the ability to memorize?

    I don’t feel bad to admit that I’m shit at memorizing. I wish that I was better at it.
    For me it’s a delight to use a language that doesn’t force me to remember the types that things have, the names of the variables and functions etc.
    I’m encoding as much as possible into the type system so that I don’t have to remember. The compiler remembers for me and corrects me if I recall something incorrectly.

    The bonus of this is that it’s good for working with teams. Because you can't hand your brain over to your colleague.
  • 0
    @jestdotty being bad at something doesn‘t mean not being able to do it at all.
    Why do I need to explain this to a dev?

    Memorizing details is hard. Memorizing concepts is easier.
  • 2
    I have to scope things to keep my sanity. Very clear lines of do this, then do that. I don't have any desire to try and manage more than a few variables in a context.
  • 1
    @Demolishun there is even a term for this: cognitive load. It‘s widely accepted that it‘s good if the tool that you are using requires less of cognitive load.
  • 0
    @jestdotty because the only way to understand your comment is that you were implying that being able to memorize is directly related to how well you can perform thinking tasks.
    This is just… nuts.

    Of course I know that some level of memory is required to be able to think. That‘s obvious and not what I was talking about. Why even mention it? Feels like you want to steer away from the topic.
  • 0
    @jestdotty it is just divide and conquer. Smaller functions and more objects defined for smaller focus. Avoiding do all classes.
  • 1
  • 1
    @jestdotty "if you can't keep stuff in there there's nothing for you to move around" - yeah, but if you keep all your brain-ram filled with meaningless trivialities only necessary to handle a garbage-tier scripting language, all the really important information stays unloaded on the brain-harddrive.

    the more you have to worry about how to make JS _work at all_, the less capacity you have for thinking about how to write good code.
  • 0
    @tosensei thanks, I failed at explaining it in such a concise way that you did.

    Then the rest of the comments are an expression of my frustration and inability to comprehend how using brain capacity to keep useless shit the head is considered "thinking about the code" and also having fun with it.
  • 0
    @jestdotty how about you add something meaningful or insightful to the conversation?
  • 0
    @jestdotty for me it feels like you write essays about obvious or unrelated stuff to avoid to talk about the actual topic.
  • 0
    @jestdotty to prevent concurrency in a right way, you don't read the var first but mutate it directly in the lock function. So not:

    if(!is_locked)

    is_locked = true

    Two threads can validate !is_locked at same time.

    Better:

    lock_count++; // Increment directly, don't read first

    if(lock_count > 1){

    lock_count--; // cancel own update

    return false;

    }else{

    return true;

    }

    The unlock doesn't decrement and puts directly zero directly.

    The threads:

    while(isLocked()){}

    // code

    unlock

    So, mutate first, then check. It should solve concurrency issues
  • 0
    @jestdotty What question do you want to have answered, little crazy girl?
  • 0
    @jestdotty you are the one who avoids answers. Now you are listing every problem that I have talking with you and act like it’s the reverse. Disgusting. Not sure if you are trolling hard or if your brain does this shit automatically and you don’t notice.

    In case you are not trolling:
    I tried hard to have a normal conversation with you, exchanging arguments.
    After you started avoiding answers and steering the conversation into some useless discussions, I admittedly got a bit mad and tried to steer it back. You proceeded to claim that I’m snippy and unlikable and whatever and then started claiming that I’m not answering and then a lot of other weird shit about me which doesn’t make sense.
    Then you get insulted because I defend my self. And you try to make it look like I’m the fucking asshole. I’m not. I’m a nice guy. But I don’t let other people fuck with me easily.
  • 1
    @jestdotty and when all the "reflex-space" in your brain is taken up with "handling dumb JS shit needed for it not to explode during a hello world", you're fucked.
  • 0
    @tosensei by someone with "Too crazy for you" I would expect someone funny doing weird stuff to laugh about. You're quite the opposite tbh. Look at all your comments, you're not nice to anyone, besides to help someone else to kick someone down. On top of that - being such an old member with only 7 rants and ~200 ++'s to other msgs is sad and on top of that, it means you only contributed hate based on your comments. Time for some self reflection I guess.

    Also, I'm sure that dottii can outcode you using vim on a tamagotchi. Her JS/TS code is probably more efficiënt than your C code. You prolly have such a mouth / ego because you're the top of your environment. Maybe time to switch
  • 1
    @jestdotty C enrolls certain loops if end is known until certain value or so. for(int i = 0; i < 3; i++){} doesn't transpile to asm a loop in asm but duplicated three times or smth. It's possible to dump the asm code your compiler generates in background. I theory js JIT should be able to be faster than C - but i do not think there are real life examples of a whole app. Maybe some part. But in C you can write your code in a way that it always hit memory cache and stuff, so if you really know what you're doing, you're unbeatable. So, for benchmarks just translating the same source to any language doesn't reflect what a language is really capable of. The source codes shouldn't be the same but have a certain result. It's stuff you already know I guess. I quit femsplaining :D
  • 1
    @jestdotty nah, since i'm smart enough to not use javascript or any adjacent diseases, i got enough brain capacity left for a "hello world". on a good day, even for a "hallo welt", or even an "olá mundo"
  • 0
    @jestdotty "maybe you're growing soft" - you mean to tell me you're rubbing off on me?
Add Comment