Archive for August 19, 2022

Friday, August 19, 2022

Samsung’s Repair Mode

Ron Amadeo (Hacker News):

Handling data during a mail-in repair process is tough. You could wipe your phone, but that’s a big hassle. You don’t want to just send in a completely locked down device, as technicians can’t thoroughly test it if they’re locked out of everything. While in repair mode, technicians can still poke around in your device and test everything, but they’ll only see the default apps with blank data. When you get your device back, you can re-authenticate and disable repair mode and you’ll get all your data back.

This may provide a false sense of security because it’s probably not as private as actually wiping the phone. On the other hand, we’ve seen that most people can’t or simply don’t do that, so it seems like a useful idea that Apple should copy.


C23 Is Finished

Björkus Dorkus (tweet):

What’s in C23? Well, it’s everything […] present in N3047.


The new constexpr keyword for C means you don’t have to guess at whether that is a constant expression, or hope your compiler’s optimizer or frontend is powerful enough to treat it like one to get the code generation you want if VLAs with other extensions are on-by-default. You are guaranteed that this object is a constant expression, and if it is not the compiler will loudly yell at you.


While default, plain compound literals have “block scope” (C) or “temporary r-value scope” (C++), with the new storage-class specification feature, you can control that.


Go read this to find out all about the feature and how much of a bloody pyrrhic victory [#embed] was.


nullptr and the associated nullptr_t type in <stddef.h> fixes that problem. You can specify nullptr, and it’s required to have the same underlying representation as the null pointer constant in char* or void* form. This means it will always be passed correctly, for all ABIs, and you won’t read garbage bits.


If you ever used __auto_type from GCC: this is that, with the name auto.


Google Searches With Quotes

Yonghao Jin:

Google Search has a special operator for that: quotation marks. Put quotes around any word or phrase, such as [“wireless phone chargers”], and we’ll only show pages that contain those exact words or phrases.

Now we’re making quoted searches better. The snippets we display for search results (meaning the text you see describing web content) will be formed around where a quoted word or phrase occurs in a web document. That means you can more easily identify where to find them after you click the link and visit the content. On desktop, we’ll also bold the quoted material.


As referenced above, sometimes quoted searches match content contained within a web page that isn’t readily visible, making it seem like the content isn’t on the page when it actually is present.


Sometimes people use the standard Find command in a browser to jump to the phrase they want, after arriving on a page. If that doesn’t work, though, you can try using a developer tools option. For instance, in Chrome, you can search from within Developer Tools to match against all rendered text, which would include the text in drop-down menus and other areas of the site.

Via Dave Mark:

My number 1 issue with “quote search” Google searches is clicking on a link and not being able to find the quoted term.



Garbage Collection in JavaScriptCore

Haoran Xu:

The garbage collector in JSC is non-compacting, generational and mostly–concurrent. On top of being concurrent, JSC’s GC heavily employs lock-free programming for better performance.


The inlined metadata cellState is easy to access for the mutator thread (the thread executing JavaScript code), since it is just a field in the object. However, it has bad memory locality for the GC and allocators, which need to quickly traverse through all the metadata of all objects in some block owned by CompleteSubspace (which is the common case). Outlined metadata have the opposite performance characteristics: they are more expensive to access for the mutator thread, but since they are aggregated into bitvectors and stored in the block footer of each block, GC and allocators can traverse them really fast.

So JSC keeps both inlined and outlined metadata to get the better of both worlds: the mutator thread’s fast path will only concern the inlined cellState, while the GC and allocator logic can also take advantage of the memory locality of the outlined bits isNew and isMarked.

All this engineering notwithstanding, I still find myself using Chrome for some sites like Board Game Arena, where performance, even with an M1 Mac, is abysmal compared with Chrome on a much slower Mac.