HNHacker News
TopNewBestAskShowJobs

halayli

2,624 karma · joined September 14, 2009

Lthread author: http://github.com/halayli/lthread

Github: http://github.com/halayli/

Hydrolix Inc founder/co-founder

submissionscomments
halayli··on A software engineering interview question I like: computing the median
Not picking on you but your answer prove the parent comment's point. Your answer is that of someone that googled some answer and went with it. This problem belongs to selection algorithms and quickselect is the common approach.
halayli··on A software engineering interview question I like: computing the median
> Right out the gate: the numbers must be sorted.

if you are not aware of quickselect algorithm.

halayli··on Shipping a laptop to a refugee camp in Uganda
> Never underestimate developing countries' governments' willingness to absolutely bend their people over to extract tax revenue (and then their corrupt representatives extract bribes on top of it)

being a developing country or not is orthogonal to what you have described. The top developed nations have one or more of these issues.

halayli··on I’ve banned query strings
Nothing you said here is correct. Paths, query strings, and fragments are all well defined entities. https://datatracker.ietf.org/doc/html/rfc3986#section-3.3
halayli··on FTC action against Match and OkCupid for deceiving users, sharing personal data
To be honest, what you did here is called speculation. Claims require evidence, and you provided none. Your confident tone is unjustified imo.
halayli··on AirPods Max 2
This is false equivalence. You're describing the luxury market, a vertical that is built on decoupling the raw material cost from the price tag. And in reality it is more nuanced than just raw material as there is a lot of cost in r&d/marketing/operations etc. Nevertheless, products targeted to general consumers are much more sensitive to that deviation.
halayli··on AirPods Max 2
Reading your parent comment and the responses, I feel be missing the point others are trying to make. There's much less technology, components, and material in a headphone compared to laptops. The circuitry in the headphones is closer in complexity to a charger than a laptop.
halayli··on LLMs can be exhausting
This is a very reasonable comment. IMO it's a falacy to take into consideration the age of an account especially when it is subjective experience.
halayli··on How Kernel Anti-Cheats Work
That doesn't sound accurate. The T in TPM stands for trust, the whole standard is about verifying and establishing trust between entities. The standard is designed with the assumption that anyone can bring in their scope and probe the ports. This is one of several reasons why the standard defines endorsement keys(EK).
halayli··on Yann LeCun raises $1B to build AI that understands the physical world
I will start sharing them moving forward. I've had several parent threads deleted in the past(rightfully so) because it turned out I was responding to AI. Thank you for staying on top of this.
halayli··on FFmpeg-over-IP – Connect to remote FFmpeg servers
This is not a special case. Everything you mentioned above can actually be achieved using cli. You can create listeners, configure pipelines, and sinks(granted not ergonomic). Sinks can be HTTP post for example, and sources can be tcp listeners + protocols on top. You can also configure the buffering strategies for each pipeline.
halayli··on Yann LeCun raises $1B to build AI that understands the physical world
I feel HN comments have been getting hijacked for a long time now by LLM agents. Always so early, very positive, and hard to spot. Some replaced em-dash with --, some replace them with a single dash, some remove them all together. I wonder how much time it is taking from @dang and other moderators helping to maintain this community.
halayli··on Best performance of a C++ singleton
Totally. I always found joy solving critical performance problems because it naturally pave a path forward to peel the layers and untangle the system interactions which feeds my curiosity, and is highly rewarding.
halayli··on Best performance of a C++ singleton
agreed. Strong emphasis on "profiling and identifying the actual bottleneck". Every benchmark will show a nested stack of performance offenders, but a solid interpretation requires a much deeper understanding of systems in general. My biggest aha moment yrs ago was when I realized that removing the function I was trying to optimize will still result in a benchmark output that shows top offenders and without going into too many details that minor perspective shift ended up paying dividends as it helped me rebuild my perspective on what benchmarks tell us.
halayli··on Best performance of a C++ singleton
Yes definitely not dismissing the lock overhead, but I wanted to bring attention to the implicit false equivalence made in the post. That said, I am surprised the lock check was showing up and not the logging/formatting functions.
halayli··on Best performance of a C++ singleton
a real human. threads can exist before main() starts. for example, you can include another tu which happens to launch a thread and call instance(). Singletons used to be a headache before C++11 and it was common(maybe still is) to see macros in projects that expand to a singleton class definition to avoid common pitfalls.
halayli··on Best performance of a C++ singleton
The performance observation is real but the two approaches are not equivalent, and the article doesn't mention what you're actually trading away, which is the part that matters.

The C++11 threadsafety guarantee on static initialization is explicitly scoped to block local statics. That's not an implementation detail, that's the guarantee.

The __cxa_guard_acquire/release machinery in the assembly is the standard fulfilling that contract. Move to a private static data member and you're outside that guarantee entirely. You've quietly handed that responsibility back to yourself.

Then there's the static initialization order fiasco, which is the whole reason the meyers singleton with a local static became canonical. Block local static initializes on first use, lazily, deterministically, thread safely. A static data member initializes at startup in an order that is undefined across translation units. If anything touches Instance() during its own static initialization from a different TU, you're in UB territory. The article doesn't mention this.

Real world singleton designs also need: deferred/configuration-driven initialization, optional instantiation, state recycling, controlled teardown. A block local static keeps those doors open. A static data member initializes unconditionally at startup, you've lost lazy-init, you've lost the option to not initialize it, and configuration based instantiation becomes awkward by design.

Honestly, if you're bottlenecking on singleton access, that's design smell worth addressing, not the guard variable.

halayli··on What Is OAuth?
no offense but it looks like the reason behind oauth confusion is the author. I had to read half way through to get to a definition which was a poor explanation. Sometimes certain topics are difficult to understand because the initial person behind it wasn't good at communicating the information.
halayli··on Anthropic officially bans using subscription auth for third party use
What about using claude -p as an api interface?
halayli··on An AI agent published a hit piece on me
This is the definition of reasoning motivated fallacy. You want to believe what you want to believe.
halayli··on Mathematicians disagree on the essential structure of the complex numbers (2024)
My naive take is we discovered it as a math tool first but later on rediscovered it in nature when we discovered the electromagnetic field.

The electromagnetic field is naturally a single complex valued object(Riemann/Silberstein F = E + i cB), and of course Maxwell's equations collapse into a single equation for this complex field. The symmetry group of electromagnetism and more specifically, the duality rotation between E and B is U(1), which is also the unit circle in the complex plane.

halayli··on Frontier AI agents violate ethical constraints 30–50% of time, pressured by KPIs
Maybe I missed it but I don't see them defining what they mean by ethics. Ethics/morals are subjective and changes dynamically over time. Companies have no business trying to define what is ethical and what isn't due to conflict of interest. The elephant in the room is not being addressed here.
halayli··on Stop using icons in data tables
I am not sure the author knows what spacial frequency means. Taking a well defined measurement unit and using it as an expression feels pretencious.
halayli··on Explaining the widening divides in us midlife mortality: Is there a smoking gun?
I think parent comment was pointing to lack of establishing a causation link. The finding in their abstract is extrapolated by statistical inference. For example smokers tend to drink more etc. The paper does take such factors into account. Personally I wouldn't jump to such a strong conclusion from statistical inference because it closes the door on other factors that might be even stronger when combined together. The paper reflects motivated reasoning more than a discovery outcome. That said, smoking is of course a major health risk, I am just pointing at the research approach.
halayli··on Creating C closures from Lua closures
wasn't aware of ffcall, it's definitely a better fit
halayli··on Creating C closures from Lua closures
I feel libffi is better suited and supports most platforms.
halayli··on Ideas aren't getting harder to find
your question leaks your intentions and drives the LLM to confirm your cognitive bias. it treats your intentions as conclusion. Try to form your questions in a way that allow LLM to arrive to the word/concept of "suppression" in a more neutral probabilistic manner when the context hints to such instead of giving it the words you want to hear. Otherwise you're just falling into confirmation bias.
halayli··on Checked-size array parameters in C
on a similar note, there are also these field attributes that are very helpful for catching similar issues:

https://clang.llvm.org/docs/AttributeReference.html#counted-...

halayli··on Show HN: I wrote a minimal memory allocator in C
This is not a good idea. You're venturing in the unspecified/non-portable behavior territory.

https://pubs.opengroup.org/onlinepubs/7908799/xsh/brk.html

> The behaviour of brk() and sbrk() is unspecified if an application also uses any other memory functions (such as malloc(), mmap(), free()). Other functions may use these other memory functions silently.

halayli··on Tosijs-schema is a super lightweight schema-first LLM-native JSON schema library
That's not true based on zod docs. https://zod.dev/api?id=objects

most of the claims you're making against zod is inaccurate. the readme feels like false claims by ai.

Page 1 of 32Next →