HNHacker News
TopNewBestAskShowJobs

MaxBarraclough

11,150 karma · joined February 25, 2014

submissionscomments
MaxBarraclough··on PS5 Relapse Exploit
They could apply a different policy to their web-based dashboard GUIs (if these do exist) than to the web browser.
MaxBarraclough··on Optimizing x264 settings and per-title ladders
Interesting, thanks.
MaxBarraclough··on PS5 Relapse Exploit
At a glance, it looks like it exploits a bug in WebKit's JavaScriptCore JavaScript engine.

Does the PS5's WebKit use JavaScriptCore with JIT enabled? Have to wonder if Sony will respond by disabled its JIT, to narrow the attack surface.

MaxBarraclough··on Writing Efficient C++ Code (2013)
I think that's fair. It's neat that it's possible through C++'s template system. It wouldn't be possible in many other languages.
MaxBarraclough··on Writing Efficient C++ Code (2013)
> unlike a lot of high level languages, there isn't an extra allocation for a node structure. The node structure is a member of the structure being linked.

That's good, but it seems like how-hanging fruit. Boost offers intrusive_prt for this. [0]

make_shared goes half way, and performs a single allocation to return a shared_ptr to a new object. It eventually made its way from Boost to the standard. [1][2]

See also [3] which contrasts the two. (As you can imagine, intrusive_prt is slightly more efficient.)

[0] https://www.boost.org/doc/libs/latest/libs/smart_ptr/doc/htm...

[1] https://www.boost.org/doc/libs/latest/libs/smart_ptr/doc/htm...

[2] https://en.cppreference.com/cpp/memory/shared_ptr/make_share...

[3] https://stackoverflow.com/a/13913161

MaxBarraclough··on Optimizing x264 settings and per-title ladders
I don't know that much about video codecs, could decoding performance improve, given the reduced input size?
MaxBarraclough··on Writing Efficient C++ Code (2013)
The compiler no longer guarantees to generate confirming code, so correctness could be affected. If this weren't the case, there would be no need for a flag, it would be GCC's default behaviour.

(I'm not creata, but I imagine this is what they had in mind.)

MaxBarraclough··on Writing Efficient C++ Code (2013)
Allocation and deallocation are fairly expensive with or without modern caches though, surely?

Or are pools used to avoid that?

MaxBarraclough··on Writing Efficient C++ Code (2013)
Yes you're right. Here's an alternative that behaves the way I had in mind but doesn't support deletions, as handling deletions the way std::vector does would naturally mean relocating elements. [0]

I figure it would be possible to add support for deletions, but it would cost us: we would lose guaranteed contiguous placement of elements with neighbouring indices, and (unless no deletions are made) we'd need a private data structure to correspond vector indices to addresses, and to determine where to locate new elements. This would of course bring us back to continually paying the price of indirection overhead, and simple lock-free modifications would not be possible.

My completely unsupported guess is the cache behaviour wouldn't be too bad unless deletions (of elements that aren't at the end of the vector) are common. I imagine the cache behaviour of a linked list must depend greatly on what the allocator gives you. Presumably using a pool, specific to that particular list, could help there.

[0] https://github.com/david-grs/stable_vector

MaxBarraclough··on Writing Efficient C++ Code (2013)
I'm not sure I follow the second point. Array-based solutions are able to guarantee that an element is never relocated, it's just that std::vector doesn't offer this guarantee. The Boost libraries offer this though, they call it stable_vector.

https://www.boost.org/doc/libs/1_92_0/doc/html/container/non...

MaxBarraclough··on Writing Efficient C++ Code (2013)
Naturally the mind races to think of where linked lists are used.

The Linux kernel uses them, at least some of the time they're used with their lock-free RCU pattern. I'm not sure if it's for performance reasons though, I think they're using it in contexts where correctness requires the absence of blocking operations.

I'd expect a lock-free non-linked-list solution would also be possible, but I don't know enough to state that definitively.

https://docs.kernel.org/RCU/listRCU.html

MaxBarraclough··on Writing Efficient C++ Code (2013)
I'm no expert in this stuff but:

creata's comment [0] mentions the works of Agner Fog, which seem very good, and are freely available.

I haven't read C++ High Performance [1] but it looks like it covers the sorts of topics you'd expect, although it looks like it doesn't cover computer architecture in detail e.g. branch prediction. There are books on that too, of course.

[0] https://news.ycombinator.com/item?id=49868657

[1] https://www.packtpub.com/en-us/product/c-high-performance-97...

MaxBarraclough··on Writing Efficient C++ Code (2013)
I've not read Fog's Optimizing software in C++ but I see it's freely available there as a PDF (182 pages). Looks like a great resource on these topics.

https://www.agner.org/optimize/optimizing_cpp.pdf

MaxBarraclough··on Writing Efficient C++ Code
That has a similar problem to the article, it's trying to fit far too much into too small a format.

What you've written mostly makes sense to someone who already has a solid understanding of SIMD and of C++ (although I can't say I follow all of it), but the target audience is people who don't. For them, each point needs a much lengthier explanation.

MaxBarraclough··on Writing Efficient C++ Code (2013)
There's no mention of branch prediction, or context switching, or synchronisation. Depending on what you're doing, they could be very consequential. There's only very brief mention of parallelisation with threads and with SIMD.

High-performance programming is a big topic. The scope is far too broad for a single blog post, which naturally gives only cursory discussion of C++ and computer architecture. The article isn't bad considering, but I do think it's the wrong format. A blog series, or even a book, would be more fitting.

MaxBarraclough··on On caring for user data: NeoVim caused Vim undo files to be deleted
Vim's persist undo is disabled by default, perhaps for privacy reasons. edit: I see sebzim4500 got there first.

* https://news.ycombinator.com/item?id=49867678

* https://bastian.rieck.me/blog/2015/persistent_undo_vim/

MaxBarraclough··on How I changed teaching after AI managed to do all my homework assignments
The linked video is Planning a Heist - Key & Peele.

Please include a description of what you're linking to. People aren't likely to follow a link to an unknown YouTube video.

MaxBarraclough··on How I changed teaching after AI managed to do all my homework assignments
> doesn't this highlight how mundane and rote teaching has become

The example questions given in the article do not assess wrote learning.

> It's been distilled to the point that the lowest of the lowest common denominators can pass.

Have pass rates been increasing? Unless I missed it, the article doesn't say so.

> forced to learn things they will never use

A computer science degree is not a coding academy, it's a basic grounding in an area of study. A computer science graduate should have some understanding of theoretical computer science and of computer architecture, say, even if they're unlikely to apply these topics directly in their careers.

> My hope is that this is a wake up call to teachers / professors to find a better way to evaluate students. To determine who has actually come away with a real understanding, vs those who were running around copying the assignments off of their peers anyway.

Academics are already aware of the importance of fair assessment, but it isn't easy, especially with LLMs in the mix.

> These same people are now just skipping the peers and going straight to the all knowing oracle. It's the same as it ever was, degree mills.

Students that cheat, and degree mills, are two different things.

MaxBarraclough··on Modern Object Pascal Introduction for Programmers
I wasn't able to find a definitive account of why they're separated in Ada, but I believe the idea is this: functions are for where code behaves in a roughly functionally pure way and yields a value that should not be discarded by the caller, whereas procs are for functionality with 'deep' side-effects.

The SPARK subset of Ada comes pretty close to enforcing purity of Ada functions, although it still permits them to read globals. [0]

It's not just an oversight. The core of the Ada language was designed deliberately. [1]

[0] https://learn.adacore.com/courses/intro-to-spark/chapters/01...

[1] https://en.wikipedia.org/wiki/Ada_(programming_language)#His...

MaxBarraclough··on We're gonna need a lot more mathematicians
In the case of medicine it goes deeper than that, sometimes nobody really understands why a medication works.
MaxBarraclough··on How I changed teaching after AI managed to do all my homework assignments
> If they had a fire under their ass that made them realize if they don't study well, they will forever be locked into flipping burgers or being homeless, most of them would move their assess.

That strikes me as backward. The higher the expected monetary value of good grades, the more students will prioritise grades over deep learning.

MaxBarraclough··on How I changed teaching after AI managed to do all my homework assignments
> Many of them just dumped the document into an LLM, asked it to produce some "exam guide", and showed up with that thing printed out, asking me during the test to explain what LLM output meant.

That student presumably performed poorly on the test. Your approach is working as intended here, isn't it?

Also, is the AI-generated exam guide all that different to a human-written guide they could have downloaded a decade ago?

MaxBarraclough··on Typst makes big strides
As someone who hasn't used Typst, how manual was the conversion process?
MaxBarraclough··on C++26: Trivial infinite loops are no longer undefined behaviour
Is there any significant performance difference?
MaxBarraclough··on Book review: Is parallel programming hard, and, if so, what can you do about it?
> Parallelism without concurrency is useless

SIMD is parallelism without concurrency.

MaxBarraclough··on Java 27
Move fast and break things does not describe Java well at all.

Their process is still very deliberate, they go to some lengths to avoid getting it wrong when they add new features to the standard. New features have to get through their preview phase successfully before becoming final. [0]

They're also pretty committed to not breaking existing source code or bytecode.

[0] https://openjdk.org/jeps/12 JEP 12: Preview Features

MaxBarraclough··on High-performance garbage collection for C++
It's a non-moving collector. It might be high performance by the standards of C++ garbage collectors, but I doubt its performance could be anywhere near what a decent JVM can manage, especially in the absence of finalizers/destructors.

As Ron Pressler (pron here on HN) has been emphasising recently, [0] the 'sweep' phase of a moving garbage collector is unaffected by the size or number of dead objects in the heap (at least in the typical case, where there are no finalizers). This isn't the case here though (it uses free lists), or in any C++ GC.

The policy of running all destructors on the same thread doesn't really seem like 'high performance' architecture either, even if there are good reasons for it.

Still a neat project though. I rather like this:

> Oilpan uses a Clang plugin that statically verifies, among many other things, that no heap objects are accessed during destruction of an object

I'm not sure I understand this:

> Oilpan is a garbage collector written in C++ for managing C++ memory that can be connected to V8 using cross-component tracing that treats the tangled C++/JavaScript object graph as one heap.

In what sense are they treated as one heap? How can they be, given that V8 uses a moving GC for its JavaScript heap? Does it just mean there's some mechanism for a C++ object to refer to a JavaScript object, and vice versa?

[0] https://youtu.be/xr73mR7ii9M?t=1081 Principles of Memory Management in Java, September 2026

MaxBarraclough··on Why is Google still serving dodgy ads?
In July there was a BBC article on this, and how they were advertised on Facebook and YouTube.

https://www.bbc.co.uk/news/articles/cj6g41pzy41o

MaxBarraclough··on LG denies TV spying claims, says tracking and snooping concerns 'not true'
From Nov 2013, but still related:

LG Smart TVs logging USB filenames and viewing info to LG servers https://doctorbeet.blogspot.com/2013/11/lg-smart-tvs-logging...

HackerNews discussion (178 comments): https://news.ycombinator.com/item?id=6759426

MaxBarraclough··on Flights cancelled at UK airports due to ATC issue
> I did not claim nobody's medical care was affected.

You said the flight doesn't contribute to preventing harm to anyone. Interfering with medical care is a clear form of harm, that's why I focused on it.

> it's not common to fly for medical care (yes, very rich people may have a different perception, but that's all it is)

That's incorrect on both counts: it's common, and it's not just rich patients. Please take a look at the Medical tourism Wikipedia article I linked above. Cost-reduction is a major motivation of medical tourism.

From [0] :

> in 2016 nearly 144,000 UK citizens travelled abroad for medical treatment. The survey suggests a steady increase since 2000, even though the 2016 sample of 250,000 travellers represent 0.23% of the total number of travellers entering or leaving the UK.

See also [1].

[0] https://doi.org/10.58248/PB38 Outward medical tourism (2020)

[1] https://pmc.ncbi.nlm.nih.gov/articles/PMC3812100/ Medical Tourism: A Cost or Benefit to the NHS? (2013)

Page 1 of 34Next →