Live data from Hacker News

Are you telling me a readonly property is wrecking my performance?

shub.club

11–20 of 40 posts

Re: Are you telling me a readonly property is wrecking my performance?

#11

Which is why Zig's top feature on its webpage is "No hidden control flow."

Ironically, the 'no hidden control flow' was one of the arguments against Zig in the recent Bun rewrite to Rust.

https://bun.sh/blog/bun-in-rust

So sometimes hidden control flow is needed.

Re: Are you telling me a readonly property is wrecking my performance?

#12

Which is why Zig's top feature on its webpage is "No hidden control flow."

Ironically, the 'no hidden control flow' was one of the arguments against Zig in the recent Bun rewrite to Rust. https://bun.sh/blog/bun-in-rust So sometimes hidden control flow is needed.

That tells you more about the people writing Bun than it does Zig or what's "needed" for people actually writing and reading code. Bun dev is not just hiding the control flow, their goal is to hide all of the code so that no human reads it, ever.

Re: Are you telling me a readonly property is wrecking my performance?

#13

Which is why Zig's top feature on its webpage is "No hidden control flow."

Ironically, the 'no hidden control flow' was one of the arguments against Zig in the recent Bun rewrite to Rust. https://bun.sh/blog/bun-in-rust So sometimes hidden control flow is needed.

> Ironically, the 'no hidden control flow' was one of the arguments against Zig in the recent Bun rewrite to Rust.

Yeah, but that makes sense: if you want "hidden everything", which they appear to want due to now having a code base that has never been read by a human, then a subset of "want everything hidden" is "want control flow hidden".

Re: Are you telling me a readonly property is wrecking my performance?

#14
Even without this performance hit, an often used way for implementing 'auto scroll to top/bottom' is to first check if there's no other stuff coming in before starting to actually scroll. This goes unnoticed by the user but drastically reduces the number of updates (and in this case, number of calls to scrollHeight) needed when a lot of data is coming in in batches. Principle is like: receive message, add to buffer and start timer of like 50ms. Upon timer tick copy everything from buffer (which in the meantime can have accumulated more data) to rendering and only then update scroll.

Re: Are you telling me a readonly property is wrecking my performance?

#15

Earlier quoted context omitted.

Ironically, the 'no hidden control flow' was one of the arguments against Zig in the recent Bun rewrite to Rust. https://bun.sh/blog/bun-in-rust So sometimes hidden control flow is needed.

> Ironically, the 'no hidden control flow' was one of the arguments against Zig in the recent Bun rewrite to Rust. Yeah, but that makes sense: if you want "hidden everything", which they appear to want due to now having a code base that has never been read by a human, then a subset of "want everything hidden" is "want control flow hidden".

Honestly I am pretty sure AI would be better at zig than rust since zig has no hidden control flow which means that AI has the full context of any given function without having to find traits. The rewrite to rust from bun is as much of as PR stunt as fustration with DX of zig.

Every time I want to interact with zig code I just have the AI do it since I honestly can't be asked to change 3 lines and around 3 to 5 characters when it's a single keybind in every other language which in turn has lead me to experiment quite a lot 'writing' in zig. It's rather pleasant to look at, however, I wouldn't want to write code myself.

Rust is by far the most enjoyable dx experience since everything usually 'just works' across machines and even architectures while having a strong sense of assurance that compiled applications will work as expected before ever running them once. node/bun/whatever is probably the worst here since compilation means nothing for runtime as undefined symbols will happily 'compile' (transpile?).

Re: Are you telling me a readonly property is wrecking my performance?

#16
post #5

The biggest performance bomb you can have in your code is a loop that does something like for (...) { el.style.height = `${something}px`; whatever.value = el.style.offsetHeight; } This forces the browser to recalculate layout multiple times in a single frame. Separating layout changing code from measurement code will help a lot here (most frameworks out there have solved this so we don't have to be too concerned abou…

[dead]

Re: Are you telling me a readonly property is wrecking my performance?

#17

Earlier quoted context omitted.

Ironically, the 'no hidden control flow' was one of the arguments against Zig in the recent Bun rewrite to Rust. https://bun.sh/blog/bun-in-rust So sometimes hidden control flow is needed.

That tells you more about the people writing Bun than it does Zig or what's "needed" for people actually writing and reading code. Bun dev is not just hiding the control flow, their goal is to hide all of the code so that no human reads it, ever.

I mean, there's an easier way of doing that than rewriting to another language, just make the repo private.

Re: Are you telling me a readonly property is wrecking my performance?

#18
post #14

Even without this performance hit, an often used way for implementing 'auto scroll to top/bottom' is to first check if there's no other stuff coming in before starting to actually scroll. This goes unnoticed by the user but drastically reduces the number of updates (and in this case, number of calls to scrollHeight) needed when a lot of data is coming in in batches. Principle is like: receive message, add to buffer a…

IME, this absolutely doesn't go unnoticed, except in trivial cases.

Re: Are you telling me a readonly property is wrecking my performance?

#19
post #14

Even without this performance hit, an often used way for implementing 'auto scroll to top/bottom' is to first check if there's no other stuff coming in before starting to actually scroll. This goes unnoticed by the user but drastically reduces the number of updates (and in this case, number of calls to scrollHeight) needed when a lot of data is coming in in batches. Principle is like: receive message, add to buffer a…

Indeed. It's the same principle[0] the other way too - start a timer from user typing for an autocomplete function and only refetch after the timer expires.

[0] https://developer.mozilla.org/en-US/docs/Glossary/Debounce

Post reply on HN