2024-04-05 00:06:59 i've never noticed a difference from aligning the body of a loop to a paragraph or cache line or whatever 2024-04-05 00:07:27 some cpu nop have side effects (??) 2024-04-05 00:07:45 m68k treats a nop as a change-of-flow instruction, like a branch 2024-04-05 00:08:13 for a 1 cycle instruction that does nothing, m68k recommends TRAPF 2024-04-05 00:10:00 whoops i thought this was ##asm ! 2024-04-05 00:11:00 basically the same channel 2024-04-05 00:42:28 dave0: i've never been able to measure a difference when aligning, either. not that i've put that much effort into it, but my limited experience has led me to believe code alignment on x86 is a myth, at least on the cpus that i own 2024-04-05 00:43:15 pretty sure sparc is more rigorous about alignment, from mailing list noise 2024-04-05 00:44:17 although alignment is critical in maybe small images, or distributions of your code, it would seem with speed and cost of development that alignment doesn't matter much any more. 2024-04-05 00:44:36 wasted space, likely yes, even 2x, and/or speed increases in the 10-20% if any. 2024-04-05 00:44:55 but ultimately, it seems alignment is for the most part meaningless now. 2024-04-05 00:45:36 the biggest issue might be portability. 2024-04-05 00:46:40 if you aren't concerned about ANSI or easy porting, or just 'doing the right thing', don't worry, be happy. 2024-04-05 00:47:26 Apple wanted the asm aligned on AMD64, but apple is weird and different 2024-04-05 10:38:39 zelgomer: On new x86 anything is 'aligned' for most performance purposes if it fits in a cache line 2024-04-05 10:38:48 So if it's unaligned but not at edge of a cache line it's aligned 2024-04-05 10:38:55 'aligned' 2024-04-05 10:39:51 Whereas over-aligning can move important things out of cache, that will negatively impact performance 2024-04-05 10:42:51 I think performant loops are worth aligning, assuming they're 'hot' code, and if the loop lives long enough the code preceding can be entirely evicted from instruction cache leaving the loop using the minimum number of cache lines, which can improve cache usage 2024-04-05 10:43:14 Aligning to 64 I mean 2024-04-05 10:44:29 The ability to profile and tune optimisers automatically is clearly important, there's no set of rules that will give the best result without profiling 2024-04-05 10:55:12 a typical forth implementation in C would allow resizing the stack, or would it have a fixed length and reside in a static memory? 2024-04-05 10:55:34 (pardon me if it is a stupid question:) 2024-04-05 11:44:48 Of course you could do it either way, but more performant implementations would avoid any sort of linked-list based stack where you allocated cells as you went along. All you need for a stack is a pointer to a range of RAM, so it would be easy to malloc a new larger block of RAM and point at it if you wanted a bigger one - the underlying code wouldn't even know that you'd changed anything, since it would 2024-04-05 11:44:50 just be using the pointer. 2024-04-05 11:45:16 Usually there would also be a Forth variable storing the "bottom" address of the stack too (i.e., the stack pointer when nothing is on the stack). 2024-04-05 11:45:44 That variable is usually called SP0. 2024-04-05 11:46:54 Are you doing a C implementation? 2024-04-05 11:48:08 well, kind of / not really :) I'm restructuring ECL and I want to have early environment access 2024-04-05 11:48:39 (and I need to move stacks before the garbage collector is initialized, but that's irrelevant) 2024-04-05 11:48:52 ECL? I'm a hardware guy - for me ECL is an old type of digital logic (very fast in its day - emitter coupled logic). 2024-04-05 11:49:06 embeddable common lisp 2024-04-05 11:49:12 Oh, cool. 2024-04-05 11:49:41 I got off on a Lisp jag once a few years ago - I decided that a simple one could rival Forth in its implementation simplicity. 2024-04-05 11:50:07 in fact ecl already features forth-like interpreter 2024-04-05 11:50:16 I've thought at times about doing a system that has Forth and List both running side by side, and rig it so Forth could pass strings into Lisp. 2024-04-05 11:50:26 but it is introduced relatively late in the bootstrap process 2024-04-05 11:50:35 I see. 2024-04-05 11:51:26 Oh, to round out the hardware lesson, ECL was very power hungry. That was its downside. It didn't drive the transistors as hard into saturation as other styles did, so switching required less charge motion. 2024-04-05 11:52:06 But that meant flowing the "on" current through a higher voltage. 2024-04-05 11:53:07 ACTION has rather shallow knowledge about hardware 2024-04-05 11:54:26 It's really my "competence" - I'm mostly a hack on the software front. I can usually get things to work the way I want them too, but I wouldn't call it "professional caliber." 2024-04-05 11:54:51 Ugh. "To." The way I want them "to." 2024-04-05 11:56:41 I did a C Forth a few years ago (well, maybe it's getting to be more than a "few" now). I used gcc, so that I could exploit it's pointer to labels function. That let me make it actually WORK like a proper Forth. 2024-04-05 11:57:12 All the machine code bits were C snips, but they threaded together in the right and proper way. 2024-04-05 11:57:46 if you are interested in the interpreter I've mentioned earlier: https://gitlab.com/embeddable-common-lisp/ecl/-/blob/develop/src/c/interpreter.d 2024-04-05 11:57:57 The main shortcoming of using C is that you can't really use registers the way you would in an assembly implementation. 2024-04-05 11:58:01 the ".d" means, that @'symbol' will be preprocessed, otherwise it is C99 2024-04-05 11:58:17 Neat - I will go take a look at it later in the morning. 2024-04-05 11:59:09 I've got plans on the drawing board for a new Forth, but it's been quite a while since I've really worked on it. I have a tendency toward having my interest jerked around toward all kinds of things. 2024-04-05 11:59:41 I've got a woodworking project that's taking up my time right now. 2024-04-05 11:59:42 I know the pain, I have a few things I'm torn about myself 2024-04-05 12:00:49 I'm trying to build a functionally correct Enigma cipher machine. 2024-04-05 12:02:15 Which at the moment is just a whole lot of boring holes in pieces of wood - not terribly gratifying yet. 2024-04-05 12:04:49 "'The Writer' Automaton" https://www.youtube.com/watch?v=laJX0txJc6M 2024-04-05 12:09:07 Holy cow. 2024-04-05 12:09:17 240 years ago? That's astounding. 2024-04-05 12:09:58 That's a clip from a documentary called Mechanical Marvels, I can recommend it 2024-04-05 12:10:09 I will find that. 2024-04-05 12:10:22 That must have taken forever to make. 2024-04-05 12:11:12 Ah, here it is https://archive.org/details/mechanical.marvels.clockwork.dreams 2024-04-05 12:12:37 Thanks - that will be fun. 2024-04-05 12:12:44 I remember reading about automata a long time ago and they talked about things like mechanical ducks which would eat corn and suchlike 2024-04-05 12:13:10 It seemed unlikely but seems more likely after seeing that writer :P 2024-04-05 12:13:12 It's pretty amazing to me that could be made to work before modern manufacturing methods. 2024-04-05 12:13:51 But I guess Swiss watchmakers have been doing minature precision for a long time too. 2024-04-05 12:15:26 Precision has been on my mind - I'm struggling with it right now. This thing I'm building has all these wheels; they all have to have 26 electrical contacts around the periphery, and those paths have to "make" all the way through in all 26 positions of every wheel. 2024-04-05 12:15:40 I THINK it's going to be ok, but I'm not far enough along to be sure yet. 2024-04-05 12:16:05 I'm trying to do it in a way that makes success as likely as possible. 2024-04-05 12:16:33 I think the documentary talks about watchmakers and precision 2024-04-05 12:17:16 I've got it queued up in a tab. 2024-04-05 12:18:05 I've been watching a lot of videos on related things, and I just want to cry a little when I see all the fancy machinery most of those guys seem to have in their shops. 2024-04-05 12:18:21 I have an old TV hooked up as a second screen so I can watch stuff 2024-04-05 12:18:32 Neat. 2024-04-05 12:19:25 I think I have a second project queued up. My wife and one of my daughters have been doing a lot of gardening recently - sprucing up the back yard. I think I want to make a sundial to go out there, kind of as "my contribution." 2024-04-05 12:19:58 But I do want them to like it / think it's attractive, and not just a science project that I slapped into the middle of their work. 2024-04-05 12:20:39 Ideally I'd like to do one that tells you the date as well as the time; I'm still dredging up videos and contemplating possible designs. 2024-04-05 12:21:56 I saw one that looked promising - it's an "interactive" one, in that to use it you have to turn a piece so that the sun shines through a little hole onto a line, and when it's in that position a needle on the thing you turn designates the time. And the sun dot gives you the data (roughly). 2024-04-05 12:22:22 You do have to know what half of the year you're in, though, because that line kind of makes a figure 8 shape and you need to know which side to use. 2024-04-05 12:23:10 The neat thing about it, though, is that that process of dotting the line automatically incorporates what they call "the equation of time" (the difference between solar time and standard time, which varies during the year). 2024-04-05 12:24:07 That sounds like those buildings constructed so that the sun shines through a window at e.g. the equinox 2024-04-05 12:24:19 Yes, kind of. 2024-04-05 12:24:25 Modern Stonehenges. 2024-04-05 12:25:31 https://www.youtube.com/watch?v=_yoSDEIL5ec 2024-04-05 12:25:50 That one's wood - I'd want to use metal for an outdoor design. 2024-04-05 12:29:43 I have been disassembling a cheap mechanical watch, need to carry that on and see if I can get it all back together and working eventually 2024-04-05 12:29:55 jackdaniel: This next Forth I want to do is kind of a combination of a byte code interpreter and a code threaded Forth; the byte code interpreter would implement a virtual machine I'm working out, and then the Forth would be written code-threaded using that machine's instruction set. 2024-04-05 12:29:57 Really fun little hobby for patient people with steady hands 2024-04-05 12:30:06 I'm not that patient though 2024-04-05 12:30:17 Oh, good luck with that. Historically I've not had good luck on such things. 2024-04-05 12:30:36 I'm physically clumsy :/ 2024-04-05 12:30:40 Weirdly the best tip for lack of steady hands is using a good magnifying glass or microscope, your brain controls your hands better if it can see what it's doing 2024-04-05 12:30:42 I'm also not the most patient person - I'm having to kind of fight that on this Enigma thing. 2024-04-05 12:31:11 I want to build the whole set of rotors that it had historically, so it's a good bit of "duplicate work." 2024-04-05 12:31:17 Yes I think that's a mark of a software person, being impatient, what steers a lot of us away from more delicate work 2024-04-05 12:31:28 Wiring them is going to be particularly tedious. 2024-04-05 12:32:02 True - software does often give "quick gratification." 2024-04-05 12:32:22 And very low punishment for mistakes. 2024-04-05 12:33:39 Looking at a watch under magnification is great, it's like suddenly you can see this little world that was hidden 2024-04-05 12:33:43 Although I saw a video last week about that post office thing you guys have going on over there - I guess that showcases the suffering mistakes can cause. 2024-04-05 12:33:57 Yes very true 2024-04-05 12:34:15 That all just kind of blew my mind. 2024-04-05 12:34:19 That was more than just mistakes though 2024-04-05 12:34:27 Yes, very much so. 2024-04-05 12:34:48 Badly designed, badly implemented then deliberately covered up 2024-04-05 12:34:56 Yes. 2024-04-05 12:35:04 Chuck the problem onto someone else. 2024-04-05 12:35:20 Although I think there's a lot of misinformation around on that, I don't think the media's been critical enough of the other side. Probably because it's more of an organisation than an individual. 2024-04-05 12:35:50 Problem is if you don't look for the truth hard enough then it will appear anyway with force eventually 2024-04-05 12:35:54 Yeah, I guess one should be careful about absorbing information from YouTube. 2024-04-05 12:36:13 For sure - things do have a way of coming out in time. 2024-04-05 12:39:14 Well I won't comment on which person it was, but one of the high-profile people who was 'wrongly' accused, I read their case, High Court judgement etc, and found that they had been treated appropriately. They're now going to be rewarded a huge sum of money even though they clearly deserved to be sued. And the logic for this was that their case hinged on the horizon system being infallible or trustworthy. 2024-04-05 12:39:20 But reading the original case, the opposite is true. 2024-04-05 12:39:22 I would guess that's a minority(?) 2024-04-05 12:39:28 Or there would probably be more reporting on this 2024-04-05 12:39:54 But I think generally Post Office v people is like a goliath vs David thing and the media isn't interested in defending institutions 2024-04-05 12:40:07 But I don't think honesty is for the sake of institutions, but us all 2024-04-05 12:40:50 I don't know about it much but would guess our legal system is struggling to cope with the concept of a class action suit, which this essentially is, and it's the first ever in UK law 2024-04-05 12:41:10 It's all fresh untrodden snow for lawyers to go make tons of money 2024-04-05 12:41:33 I don't think the legal situation in the US is desirable but ever since Thatcher we've been heading that way 2024-04-05 12:42:25 Anyway I hope that regardless this scares institutions into thinking about "the little people" 2024-04-05 12:43:53 But more than likely it's just a racket for slimy law people to generate cash while our public solicitors have no money, we don't have time to get victims their cases in court, etc 2024-04-05 12:47:09 Also legal people and now outsiders are commenting on the fact that the Post Office was allowed to prosecute, as if that's wrong. I don't see why they shouldn't be allowed to do so, especially as the CPS is so backed up and refuses to prosecute even obvious open+shut cases. 2024-04-05 12:47:26 Lots of people looking for quick fixes to an injustice, there's no quick fix 2024-04-05 12:48:14 In a lot of ways the legal situation over here is a mess. 2024-04-05 12:48:37 Generally speaking just "too much of it." People will sue over practically anything. 2024-04-05 12:48:58 Works out well for the lawyers, I guess. 2024-04-05 12:49:05 Yeah and that's how I see this group / class-action thing turning out over here 2024-04-05 12:49:24 For which this group horizon case was the first of that kind 2024-04-05 12:49:43 A lot of legal people's eyes turned in £££ signs when they saw this 2024-04-05 12:49:52 Lawyers LOVE class action suits. 2024-04-05 12:50:57 I got notified by mail that I was a candidate party in one once. Something to do with the way my cellphone company had billed during some period of time. 2024-04-05 12:51:11 In the end I wound up getting a check in the mail for thirty seven cents. 2024-04-05 12:51:26 I have no doubt the lawyers did considerably better. 2024-04-05 12:57:12 I also hope that the attention this case gets will make people question IT systems more, because they are awful and do have lots of gaps that hurt people 2024-04-05 12:57:48 That would be a positive takeaway. The idea that computers never make mistakes is pretty dangerous. 2024-04-05 12:58:41 That's the thing, computers rarely make mistakes, and can be made foolproof, but IT software is awful and just gets worse, not better. And lots of people are made to deal with software that's so bad they would be better off keeping track on paper 2024-04-05 12:59:03 Yeah. 2024-04-05 12:59:08 One case I heard of a postmaster was an accountant, and kept track of everything fine for years, and then moved to Horizon system early and ran into endless accounting issues with it 2024-04-05 12:59:18 I didn't verify this one but I believe it 2024-04-05 12:59:28 They were actually local to where I live now 2024-04-05 13:00:11 And they paid thousands to Post Office to rectify the differences 2024-04-05 13:14:20 I've noticed lately that there are a lot of videos on logarithms. And the tendency seems to be to present them as this incredible amazing thing (which they are, of course). But I've always thought of logs as more or less the same kind of "bread and butter" as arithmetic - it's surprising to me to see them presented as something that large parts of the audience doesn't already know. 2024-04-05 13:19:19 don't 2024-04-05 13:26:49 I'm 30, when I was in school logs weren't introduced until I was 16/17, and got barely any mention. I imagine they have been deemphasised because of the proliferation of cheap calculators 2024-04-05 13:27:38 But weirdly we still had log tables in formula book 2024-04-05 13:31:35 I think we may "deemphasize" too much. 2024-04-05 13:31:59 I still am bummed that dimensional analysis wasn't really taught in a "real" way when I was in college. 2024-04-05 13:32:35 "Why" things work is important too. 2024-04-05 13:48:05 I did some dimensional analysis in mechanics and it got mentioned in physics as well 2024-04-05 13:48:11 I went to quiet a good school though 2024-04-05 13:48:15 quite* 2024-04-05 13:49:37 I was exposed to the phrase, and had the basic idea of "checking units" taught to me pretty well. But I discovered later in life that there's a lot more to it than that. 2024-04-05 13:50:34 The whole business of studying a dynamic system by seeking out its dimensionless parameters and working with those, instead of with the "direct and obvious" quantities - in some cases you wind up working with fewer variables. 2024-04-05 13:50:49 I had to discover it on my own in a pdf doc I dredged up online. 2024-04-05 13:55:21 The best way to learn 2024-04-05 13:55:27 Not even joking 2024-04-05 13:55:45 Ugh I hate school, everything, I'm too cynical. Forgive me 2024-04-05 13:57:30 This is the stuff of nightmares https://www.youtube.com/watch?v=7jAJbxTb57Q 2024-04-05 14:04:01 I wonder if Victorians found them creepy as well, surely they did 2024-04-05 15:15:44 veltas> zelgomer: On new x86 anything is 'aligned' for most performance purposes if it fits in a cache line 2024-04-05 15:15:53 so in other words, don't cross a 64-byte boundary in hot loops and you're fine? 2024-04-05 15:16:09 I mean for data accesses 2024-04-05 15:16:15 I assume true for i cache too though 2024-04-05 15:16:28 i see. thanks! 2024-04-05 18:55:09 veltas: I've thought about trying that. If I was to decide to move away from my little vm it's probably the route I'd take. 2024-04-05 18:58:06 GeDaMo: lol the words "The isn't a JVM" even appear in that text 2024-04-05 19:09:57 zelgomer: They can syscall the kernel 2024-04-05 19:10:07 Otherwise they wouldn't be able to do anything other than be debugged 2024-04-05 19:10:55 You can run anything built statically, and maybe even build dynamic linked environment for it, but you're on your own doing that 2024-04-05 19:11:11 I don't know of a distro that lets you do this willy nilly 2024-04-05 19:11:16 I looked through it, but am still confused. how does the executable run the same on a Windows kernel. Windows kernel has different syscall interface, right? 2024-04-05 19:11:39 I mean, different kernel ABI 2024-04-05 19:12:15 qemu intercepts the syscall stuff and massages it to native syscalls? 2024-04-05 19:12:28 I don't know about Windows, just know it works on Linux 2024-04-05 19:12:53 It's actually quite easy to shim most of the syscalls between different architectures 2024-04-05 19:13:00 "it reconfigures stock GCC and Clang to output a POSIX-approved polyglot format that runs natively on Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS" https://github.com/jart/cosmopolitan 2024-04-05 19:13:25 Oh I'm talking about qemu userspace, not APE 2024-04-05 19:13:30 Ah 2024-04-05 19:13:55 QEMU userspace isn't hacky or that clever, it's just very helpful 2024-04-05 19:15:12 veltas: makes a lot more sense now, thanks. this is actually very good to know! 2024-04-05 19:24:15 so, they have this list of all the functions that don't work on various OSs: 2024-04-05 19:24:18 https://justine.lol/cosmopolitan/functions.html 2024-04-05 19:29:43 Fully derailed 2024-04-05 19:29:47 No survivors 2024-04-05 19:31:12 lol 2024-04-05 19:38:16 so, is it only actually portable if you restrict yourself to posix calls supported by all OSs? 2024-04-05 19:39:10 in traditional compiling, right, you have a ifdef or something to check if the posix call is actually available, or which of several competing posix calls 2024-04-05 19:39:49 but in this approach you don't know before running the executable and getting the error, yes? 2024-04-05 19:40:22 like, some platforms supports one posix method of polling, but not the other 2024-04-05 19:41:24 like select vs poll? 2024-04-05 19:45:45 that is an example I'm thinking of from the elder days, but I'm sure modern examples could be shown 2024-04-05 22:45:04 veltas: res qemu, that's what I do to run mecrisp and a 6502 forth 2024-04-05 22:45:50 I had a 6502 assembler written in mips assembler for something else so I just ran someone else's 6502 forth in that. it runs like any other binary from the command line in linux 2024-04-05 22:45:57 assembler=emulator