Hacker News new | past | comments | ask | show | jobs | submit | yb303's comments login

Why does it sound like a remake of FlameGraph?


It didn't discover anything. It only minces words it found online up to 2021.


False.


How is this false?


In the original story they became Nazgûl after receiving the rings


Perhaps the real Nazgûl were the friends we made along the way.


The article says: "So when you change what + means, it will throw away all those methods it compiled with the old definition. Poof. Gone."

Is this enough? What about the function's side effects? If the function changed 1000 variables with the wrong + definition, is it going to roll them back?


Another 1 minute lookin... multiplication on every byte.. really? If this is supposed to be fast, get one big buffer for the words. Get another if you run out. The hash function can be the word itself for words up to length 8. Longer words would need a mult per 8 bytes. You can do branchless strchr. Roll your own memmove - just always copy 24 bytes and terminate at the length you already know. The whole point of using C or C++ is that you can do non idiomatic things when you have to.


I had a 1 minute look at the "optimized" C code - it's calling malloc for every word.


>I had a 1 minute look at the "optimized" C code - it's calling malloc for every word.

Neither simple.c nor optimized.c call malloc "for every word". They only call malloc when inserting a previously-unseen word into the counting map.


Doesn't malloc return a pointer? Sounds unsafe


That's not the point. It's perfectly safe and there's nothing else in C. The point is you don't have to call this function for every single word. It takes time and pointer increment doesn't


Ooo... spooooky pointers... ancient prophecies speak of the Earth splitting in half and swallowing everyone who's ever thought about allocating memory.


After death, the person will be giving back his/hers "water of life", like in Dune, to be reused by others :)


Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: