HNHacker News
TopNewBestAskShowJobs

hayley-patton

628 karma · joined November 13, 2021

https://applied-langua.ge/
submissionscomments
hayley-patton··on Boxed types in OCaml, and other thoughts
You can use fewer instructions if you tag integers with a zero (as SBCL does); then 2x * 2y = 4xy, which we only need to shift right one bit to get 4xy/2 i.e 2xy. But this takes a bit off your fixnum size, so you might shift an operand right, which also is just one instruction (as (2x/2) * 2y = x * 2y = 2xy).
hayley-patton··on Time is not a synchronization primitive
That was "more sophisticated" and I was given a sample script without a loop. (I got Terraform to wait in a retry loop, which was apparently too complex.)
hayley-patton··on Time is not a synchronization primitive
Did a devops elective last semester; I was surprised to hear that sleeping to wait for the system to come up was "common in the industry". 30 seconds was the magic number, which was somehow always either mostly a waste or not enough when I tried to use it.

For similar reasons, we similarly can't keep making sleep-sort faster by scaling the sleeps down.

hayley-patton··on The Mellotron, an electronic keyboard of recorded samples, changed pop music
Orchestral Manouevres in the Dark also used the Mellotron in the early 80s, all over Architecture and Morality and Dazzle Ships.

> But without actually having the confidence or the guts to work with a real choir we had to employ other means of trying to reproduce that massed choral sound, hence the Mellotrons.

For example the Mellotron provided the violin lead and choir background in their single Maid of Orleans: https://www.youtube.com/watch?v=vmwMhjbThKg

hayley-patton··on A single line of code made a 24-core server slower than a laptop (2021)
Coalescing reference counting [0] avoids almost all synchronisation. n.b. The abstract says they do "not require any synchronized operation in its write barrier" but they rely on a micro-architectural hack; in practice I'd expect one atomic test-and-set per modified object per collection.

[0] https://sites.cs.ucsb.edu/~ckrintz/racelab/gc/papers/levanon...

hayley-patton··on fe: A tiny, embeddable language implemented in ANSI C
APL, ML and Pascal too. There is a story that Ken Iverson, the inventor of APL, was passing a terminal at which a Fortran programmer had just typed:

      I = I+1
Ken paused for a moment, muttered “no it doesn’t”, and passed on.
hayley-patton··on The Rust I wanted had no future
An effect handler is allowed to invoke a continuation multiple times; I believe this is not possible with async/await.
hayley-patton··on The Rust I wanted had no future
I don't mean "effects" in the sense where you can have effect handlers which get delimited continuations and all; it'd just mark what could happen (like checked exceptions). But I can't think of any languages with that and not effect handlers; Koka, Eff, and Unison come to mind for effects, though their practical-ness may vary.
hayley-patton··on The Rust I wanted had no future
There are type systems which can track complexity (e.g. http://gallium.inria.fr/~fpottier/slides/fpottier-2011-01-jf...) but that's still different to performance; async/sync tells us things like "touches disk" or "touches network" but not "O(2^n) might take a really long time".

Alternately, an effect system can communicate "touches disk", can make functions which are polymorphic to effects (e.g. map touches the disk if the mapping function touches the disk), and can distinguish different effects, unlike async/sync being anything-or-nothing. IMO async is more of an implementation detail (as "may suspend/yield" is not a very precise or interesting effect), whereas effects would communicate the properties that ohgodplsno wants to know.

hayley-patton··on Milk-V Duo is a $9.00 RISC-V tiny embedded computer
Linux has a nommu configuration, no? Obviously no good for security, and it is still flatland, but a flatland running Linux.
hayley-patton··on Brute.Fail: Watch brute force attacks fail in real time
Once I was trying to scrape from some internal API, and made a request that used parameters the real client wouldn't make. I didn't expect curl to scream "FUCK YOU <some name>" at me. Presumably the name belonged to someone who scraped it before.
hayley-patton··on Clever code considered harmful
Well, the 2019 final exam [0] lacks such questions; it must have been some other year. But the correct data type for an "AccountBalance" variable (section C, question 9) was a float, so I definitely lost marks on that question!

The 2021 final exam (which is the most recent I can find) [1] somehow creates XML records for a SQL database (section C, question 7), and hints at using "data validation" to avoid an SQL injection (section C, question 11.c), which is quite exciting. And the 3.5 gigabit wireless connection (section A, question 13) is definitely not using an ISP-supplied router.

[0] https://www.vcaa.vic.edu.au/Documents/exams/technology/2019/..., answers https://www.vcaa.vic.edu.au/Documents/exams/technology/2019/...

[1] https://www.vcaa.vic.edu.au/Documents/exams/appliedcomp/2021..., answers https://www.vcaa.vic.edu.au/Documents/exams/appliedcomp/2021...

hayley-patton··on Clever code considered harmful
My high school computing exam (by government direction - VCE, graduated 2019) was filled with many such

    If a And b Then
      Return True
    Else
      Return False
    End If
programs. Not sure why they were so scared of Return a And b. Apparently they got a new curriculum after I graduated; my teacher was very happy about it but I didn't get to see it myself.
hayley-patton··on OS in Go? Why Not
The Go GC is precise nowadays. But there's also a kind of semi-conservative GC which can identify pointers/not-pointers in the heap, but not the stack; apparently Go 1.0 was fully conservative, 1.1-1.2 were semi-conservative, and 1.3 and on are precise.
hayley-patton··on OS in Go? Why Not
> C has no complex data structures like hashes, trees, or linked lists, and should the programmer require them, they are expected to implement their own. This provides more granular control over the code, as the programmer can tweak the details of the implementation as needed for efficiency.

It's absolutely possible to roll your own data structures, even if the language provides its own implementations. Some use their own hash map instead of std::unordered_map/set in C++, and some use hash maps specialised for primitive types in Java (as the generic HashMap boxes).

(On the contrary: do people roll good implementations of data structures usually?)

> As explained in this Reddit thread, mouse lag is likely because the interrupt handler allocates memory that triggers garbage collection.

The Biscuit paper states "the longest single GC-related pause suffered by NGINX was 115 microseconds"; I'm not sure how well that generalises to other workloads, but (infrequent already) pauses would be hard to notice if that does generalise.

hayley-patton··on Symbolics Lisp Machines Graphics Demo (1990) [video]
Right. I found <https://www.ise.io/wp-content/uploads/2017/07/apple-sandbox....> which agrees with you (on page 9). Guess it's down to defining "at runtime" now; the TinyScheme code (and GC) and Scheme code for the sandbox definitions are shipped to a user of macOS, and the user can invoke sandbox-exec with new sandboxing definitions (e.g. <https://jmmv.dev/2019/11/macos-sandbox-exec.html>), running TinyScheme and Scheme code. So I'd think Scheme is part of the entire sandbox system, even if not in the kernel?
hayley-patton··on Symbolics Lisp Machines Graphics Demo (1990) [video]
Okay, cool, but the collector is used at runtime with TinyScheme. _cons calls get_cell calls get_cell_x calls _get_cell calls gc for example; what makes you think otherwise?
hayley-patton··on Symbolics Lisp Machines Graphics Demo (1990) [video]
If referring to TinyScheme being used for sandboxing, that still uses garbage collection.

https://github.com/sungit/TinyScheme/blob/master/tinyscheme-...

hayley-patton··on The absurd cost of finalizers in Go
There's a good chance you don't want the finaliser in the object; finding finalisers to run would require reading heap memory, when sweeping otherwise just touches side tables (IIUC for the bitmap allocator Go uses).
hayley-patton··on Making GHC faster at emitting code (2022)
You make assumptions that your future interlocutors would associate the contraction "Glasgow Haskell Compiler" with the "Glorious Glasgow Haskell Compilation System" without any awkwardness on their behalf.

:)

hayley-patton··on Successful Lisp: How to Understand and Use Common Lisp (1999)
Is there any documentation on the algorithm used?
hayley-patton··on Successful Lisp: How to Understand and Use Common Lisp (1999)
Do they? I had to help SBCL with bounds checks (read: disable them) when porting the Java NonBlockingHashMap to Common Lisp. Perhaps still too micro- a benchmark, and I've indeed made turds with Spring, but the rest of HotSpot would do wonders on non-turd programs. (Would also expect Graal with JIT to be faster than AOT after warmup, but no experience there.)
hayley-patton··on Successful Lisp: How to Understand and Use Common Lisp (1999)
Not having used them, I'd expect the Truffle implementations of Python and Ruby to do well, seeing as Graal handles #2-5 of moonchild's list. From there #1 might fall out. (Apparently the fancy GCs for #6 are only in the Enterprise Edition though?)

I'm working on a better, parallel but still far from Java state-of-the-art GC for SBCL <https://zenodo.org/record/7816398> - which presumably is some skin in the game.

hayley-patton··on Return oriented programming on RISC-V – Part 1 (2022)
Then the other software mitigations listed in the article are not so useful either, because the implementation (and OS, in the case of ASLR) could choose not to use them, and the processor should execute such code too.
hayley-patton··on Return oriented programming on RISC-V – Part 1 (2022)
Right, but the ROP program is of no use if it can't be called, as stated in that quote. Hence bounds checks also avoid that class of exploits.
hayley-patton··on Return oriented programming on RISC-V – Part 1 (2022)
> What can we do to prevent ROP attacks?

No mention of bounds checks?

hayley-patton··on The seven programming ur-languages (2021)
> A lot of work was done on how to make Smalltalk run fast and efficiently, culminating in the Strongtalk project.

The Strongtalk technology also came from Self; it was thought that Self would be too hard to make fast, until it wasn't.

hayley-patton··on The Egison Programming Language
Just got it in my head after wondering the same. So we have some prefix of the list we don't care about (_) appended (++) to a variable ($p) consed before p + 2 (#(p + 2)) consed before a suffix we don't care about (_), then produce the pair (p, p + 2) for each match.
hayley-patton··on Learn C and build your own Lisp (2014)
Thanks, that's a good point. If it's also a book for learning C, I'd think the proficiency of the audience varies substantially then.
hayley-patton··on Learn C and build your own Lisp (2014)
"C programs crashing is a fact of life. If anything goes wrong the operating system kicks them out" is _very_ bad advice for someone learning C. The introduction reads

> This book is for anyone wanting to learn C, or who has once wondered how to build their own programming language.

which I interpret as having "design a language" as another goal. Arguably the book succeeds at building a programming language, but it mangles the theory in unhelpful ways, e.g. lexical scoping isn't a static analysis per chapter 16, nor is parsing the consumption of an abstract syntax tree per chapter 10.

← PreviousPage 5 of 10Next →