Are you telling me a readonly property is wrecking my performance?
shub.club
shub.club
maddening.
[0] https://developer.mozilla.org/en-US/docs/Glossary/Debounce
The API implementation was klunky though, where DOM Elements attached to the DOM became 'live' objects. Reading some of the properties would necessarily require reflowing the page in order to calculate the value. It's interesting to think about all the ways the DOM thread can stall for synchronous API's. The Paul Irish gist is always the top hit when I search:
https://gist.github.com/paulirish/5d52fb081b3570c81e3a
The mouse event ones always get me.
I'm always impressed by how old sins like element.scrollHeight can get papered over with newer API's. You can use ResizeObserver or requestAnimationFrame() to time your reads of the property and hopefully get the reflows for cheap or free.
* According to https://github.com/mdn/browser-compat-data/blob/v8.0.6/api/E..., Internet Explorer 5 had it. Unfortunately, I don't know of any way to look up which Netscape versions did.
If they can remove <blink> and <marquee>, they can provide an alternative to this.
<blink> hadn't worked for most users since 1998; Internet Explorer never supported it, and neither did Chrome or Safari. The only browser that dropped support for it was Firefox, which merely brought it in line with how other browsers had always behaved. Furthermore, when it was removed, content in existing pages' <blink> tags still appeared on the page; it just no longer blinked. So there was probably very little breakage, at least if we define "breakage" as "behavior change that causes problems for end users" rather than "any behavior change at all".
By contrast, if they remove scrollHeight, every existing page that uses it will crash.
There's actually a footnote to the <blink> saga that illustrates this perfectly. JavaScript strings have a .blink() method that surrounds them with <blink> tags (e.g., "a".blink() returns "<blink>a</blink>"). With hindsight we can say that making this a fundamental string operation was profoundly silly to begin with, and now that <blink> doesn't even work anymore it's basically 100% useless. Yet it remains in the standard, and every browser still supports it, and they almost certainly always will. Because while removing <blink> didn't cause breakage, removing .blink() absolutely would.
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 about it though).[1] https://nitter.net/awesomekling/status/2021932080742142056
This is also the case for variables. var is faster than const, because for const (and let) the engine must do additional work (related to enforcing block-level scope, if I am not mistaken).
Which is to say that if someone tells you that you should in general never use const/let for "performance" they are probably wrong, but yes there probably are still edge cases and microbenchmarks that make var look faster on some engines.
Speed and user UX are important, but if it's a screen the user is constantly watching, you might remove the abstraction. However, if it's something like a waiting screen after payment, you'd probably keep it. In the end, what matters is the user flow
https://bun.sh/blog/bun-in-rust
So sometimes hidden control flow is needed.
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".
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?).
You say that as if having to find traits was a problem ... for a bot.
Sure, but what matters is whether that's too hard for an "AI".
It also has to realize that "Drop" exists and know what it does since there's nothing in code that clearly says "this object is automatically dropped by the compiler on scope end.
Um, what readonly property?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Runtime TDZ checks can be performance issues: