2022-01-07 03:46:46 joe9: Running showstuff after it's compiled will do that 2022-01-07 03:47:37 Recommend reading Starting FORTH, it's a treat 2022-01-07 06:25:16 it is my go-to book these days. I must have forgotten about this. Let me look it up again. 2022-01-07 06:31:12 joe9: Actually, sorry I don't think those words are in starting forth 2022-01-07 06:31:15 What FORTH are you using? 2022-01-07 06:31:25 felixforth 2022-01-07 06:31:40 it is not popular 2022-01-07 06:31:48 it is small and still workable. 2022-01-07 06:31:52 Where are its docs? 2022-01-07 06:31:58 Are they online somewhere? 2022-01-07 06:32:35 "not popular" is not a problem for FORTH 2022-01-07 06:33:09 I doubt there are any. https://github.com/8l/ff 2022-01-07 06:44:56 The README contains all the non-standard words on felixforth, and the rest are ANS so download https://dl.forth.com:8443/downloads/SwiftForth-linux-macos-eval.tgz which contains "dpans.pdf" which is the ANS standard 2022-01-07 06:45:46 C" in felixforth is non-standard because it also stores it in the dictionary 2022-01-07 06:48:18 ACTION clicks 2022-01-07 06:48:57 The SwiftForth evaluation download contains ANS standard and some other good PDFs 2022-01-07 06:51:23 So the docs for that FORTH look pretty good to me, and the whole source is available and readable 2022-01-07 06:54:08 this is a good article: https://www.phaedsys.com/library/blog/data/Forth_versus_C%20Howerd_Oakford%20%20v3.pdf 2022-01-07 06:56:53 Would take it with a pinch of salt, sounds a bit ideological 2022-01-07 06:57:24 I wouldn't claim you can write FORTH faster than C in general, I certainly don't 2022-01-07 06:57:37 I happen to enjoy it more, some applications are probably faster in FORTH, but certainly not in general 2022-01-07 06:57:58 Interested to know what others think 2022-01-07 06:59:28 This thing about writing a "new language" for every problem is something I don't do, and don't really think you need to do either. It's the sort of platitude you hear from most people who learn a language with emphasis on powerful macro/interpreter features 2022-01-07 07:00:18 You'll hear the exact same argument from some lisp proponents, and yet almost no lisp code is written like that 2022-01-07 07:29:40 Chuck makes a sort of similar argument in POL but it's not quite the same as the work he was doing was more primitive, FORTH as we know it today has many more basic blocks you'd need for all sorts of programs 2022-01-07 07:34:45 after spending a couple of decades writing forth, there have only been a couple of times when I actually extended forth to a 'new language' when working with it. 2022-01-07 07:44:38 are there any metrics between subroutine threaded forth vs token threaded forth? 2022-01-07 07:45:13 s/token/direct/ 2022-01-07 07:45:32 http://www.complang.tuwien.ac.at/forth/threading/ 2022-01-07 09:05:48 I think at that link it says subroutine threading is slower without optimising, but it's the base for optimising 2022-01-07 09:06:07 I have no idea but IMO subroutine is also harder so not worth doing unless you want to optimise as well 2022-01-07 09:06:11 for speed 2022-01-07 09:06:44 If trying to be as performant as possible is not the goal then do something else, but none of the classic models make sense in 64-bit 2022-01-07 09:06:52 You probably want some kind of VM now 2022-01-07 09:07:17 bytecode 2022-01-07 09:07:58 The old-school "array of xt's" is fat and penalised for bad locality 2022-01-07 09:08:42 tokenised forths are probably not making enough intelligent use of the space, some kind of opcode system is probably what you want if not subroutine threaded 2022-01-07 09:10:04 tokenised forth is probably the simplest compromise, or using an array of 32-bit relative offsets to xt's 2022-01-07 09:10:28 veltas: would a vm that uses cell wide virtual instructons like the canonical dual stack machine from Koopmans book qualify? 2022-01-07 09:10:59 That's the sort of thing I mean by VM or bytecode yeah 2022-01-07 09:11:09 And/or whatever it is that retro does 2022-01-07 09:12:13 easy to implement as megamorphic switch inside an endless loop 2022-01-07 09:14:31 (the default case is a CALL to that forth address, while the other cases implement the primitives) 2022-01-07 09:15:10 In my mind, we are so used to JIT at this point that anything less than subroutine threading with a sprinkle of optimisation on x86-64 would be underwhelming 2022-01-07 09:15:25 retro runs on a bytecoded stack based vm, but is subroutine threaded 2022-01-07 09:18:03 You probably have more opportunity for elegance on a VM 2022-01-07 09:19:09 what I long for is cheap, opensource bitstream, partially reconfigurable fpgas/cplds 2022-01-07 09:19:52 Yeah a FORTH machine FPGA sounds neat to me too 2022-01-07 09:21:21 the trend in fpgas these years have been more and more 'hard ip cores and blocks' which is not I want 2022-01-07 09:21:44 I've been trying to convince a certain someone on this net to do that, based on another project they've been working on. 2022-01-07 09:21:59 Open FPGA fabric, that is. 2022-01-07 09:22:42 more usually 'dead' silicon, higher denisity, harder to manifacture, all results in expensive parts 2022-01-07 09:23:29 Pointy haired managers' desire for faster iteration has driven the demand for IP cores, imo. 2022-01-07 09:23:38 Everything must be agile! 2022-01-07 09:24:26 do not mind if those 'ip cores' were just soft 2022-01-07 09:25:36 I am basically looking for 7400s series equiv in manifacturing and specification for fpgas 2022-01-07 09:27:35 boru: iirc, fpga fabric as simplest are LUTs and bus routers, no? 2022-01-07 09:29:44 Amongst other LEs and stuff, sure. 2022-01-07 09:30:29 They did some work reversing some bitstreams which resulted in: https://github.com/azonenberg/openfpga 2022-01-07 09:31:23 the cell technique in https://www.digikey.com/en/products/detail/atmel/AT6002-4QI/12107934 inspired me to start specifing an LUT block (for a lack of better term) that is inspired by cellular automata with von neuman neighbour rules 2022-01-07 09:32:18 boru: do the Symbiflow folka know of this? 2022-01-07 09:32:45 Unknown to me. There are a bunch of similar projects around, but they all seem to be in silos. 2022-01-07 09:33:05 Symbiflow seems pretty awful to me. Great idea, but poor execution. 2022-01-07 09:33:18 When hardware people write software: the project. 2022-01-07 09:34:09 basically 16x16 grid of LUTs, each with North, East, West, South inputs and seprate outputs in these directions 2022-01-07 09:34:19 I'm mostly a softie these days. I only tangentially touch FPGAs at work these days, and I don't have time for my own projects much. 2022-01-07 09:34:28 Yeah, I get what you're saying. 2022-01-07 09:35:13 only, there are no state flip flops per LUT 2022-01-07 09:36:05 completely async 2022-01-07 09:37:15 Classic async designs never really made it outside academic, alas. 2022-01-07 09:37:25 Very interesting, though. 2022-01-07 09:38:43 the idea is that you basically have to treat the LUT blocks like you just had a bunch of combinational boolean logic gates 2022-01-07 09:38:48 I find anything that never makes it outside of academia quite smelly 2022-01-07 09:38:59 Heh 2022-01-07 09:39:15 "interesting but nobody uses it" is definitely an alarm bell 2022-01-07 09:39:24 Well, AMULET3 was pretty cool. 2022-01-07 09:40:03 As are stack computers and transputers. 2022-01-07 09:40:35 Things which aren't useful or turned out to be bad ideas can be the source of better ideas later. 2022-01-07 09:40:49 veltas: depends, often manifacturability, hard to develop process, etc have more say than if an technique is interesting or not 2022-01-07 09:40:51 Or ignore them, and repeat the same mistakes later. 2022-01-07 09:41:14 Yeah I shouldn't generalise 2022-01-07 09:41:46 I wouldn't be here if I thought FORTH was totally useless, and it's one of those things that's "interesting buy nobody uses" to some extent 2022-01-07 09:41:53 but* nobody 2022-01-07 09:42:08 then network effects and market dominance can entranche decissions that made sense then but dont today 2022-01-07 09:42:22 Wasn't there a user on sillynode who did precisely that? Used to show up and moan about how useless Forth was constantly. 2022-01-07 09:43:04 Me probably lol, no I don't actually remember 2022-01-07 09:43:08 dunno, got an Openfirmware based machine booting thanks to forth 2022-01-07 09:43:37 It wasn't you, no. 2022-01-07 09:43:56 The BSD bootloader is also a forth. 2022-01-07 09:44:04 Was 2022-01-07 09:44:05 and I have come across it as an inbuilt debugger in an soecialist equipment 2022-01-07 09:44:19 I don't think it's been replaced in all of them yet. 2022-01-07 09:44:24 specialist* 2022-01-07 09:44:29 Zarutian_HTC: USSR? lol 2022-01-07 09:44:34 soecialist equipment 2022-01-07 09:45:08 I think it was a typo. The joke might not translate. 2022-01-07 09:45:28 fat fingering on an virtual keyboard on smartphone, hence the _HTC suffix on my nick 2022-01-07 09:45:42 Nonetheless, it is whiskey o'clock. I have pressing matters to attend to. 2022-01-07 09:45:52 "Go FORTH, comrad!" 2022-01-07 09:46:11 I know there was a soviet FORTH-like language 2022-01-07 09:46:18 reverse polish 2022-01-07 09:47:47 so Forth is not as useless as many think 2022-01-07 09:56:05 hopefully im not the one you were thinking of who criticizes now and again. when people say unoptimized forth is 10x faster than optimized C i feel the need to speak up. unfortunately it can come off as anti-forth rather than pro-forth + pro-facts 2022-01-07 09:57:43 No, it wasn't you, either. 2022-01-07 09:58:11 And I'd say that's a sensible time to speak up. 2022-01-07 10:00:16 Every regular in here is pro-facts and realistic about FORTH IMO 2022-01-07 10:00:59 Maybe sometimes I could be accused of being a little too positive about FORTH's performance, don't worry though we can put it to the test when my FORTH's done and optimising 2022-01-07 10:02:38 I didn't intend for what I said to cause widespread self reflection. I don't precisely remember the user in question's nick, but they're not here at the moment, it seems. 2022-01-07 10:07:18 np :) 2022-01-07 10:09:00 boru: I was just kidding anyway 2022-01-07 10:10:41 from my playing around, I feel that unoptimized forth is around 3 times slower than C. This seems to be around the same as python or any other interpreter, I guess. 2022-01-07 10:12:17 Python is much slower than that 2022-01-07 10:12:23 It really depends on the FORTH, and the machine 2022-01-07 10:12:51 ya the number a lot of people throw around is 50x slower for python vs C generally speaking 2022-01-07 10:13:09 I would say on the order of 10-100 times slower 2022-01-07 10:13:54 a subroutined (ie fastest for that architecture) forth for 65C02 I measured was 10-20x slower than hand written assembly. might be worse case though since extra penalty for running 16 bit forth on 8 bit arch 2022-01-07 10:14:46 That's about what you want, BASIC tends to be like 1000 times slower, not even an exagerration 2022-01-07 10:15:00 10 times is quite a nice tradeoff in comparison 2022-01-07 10:15:22 Depends on the BASIC/FORTH but yeah 2022-01-07 10:16:10 on 6502 they claimed forth was 3x faster than BASIC though that would have been a direct or indirect threaded forth since the subroutine one i tried is modern 2022-01-07 10:16:58 I am skeptical about how much faster sub threading is on 8-bit 2022-01-07 10:17:03 apples to apples is hard to do since internally the BASIC is using a type of threading. a subroutine threaded BASIC could be written for 6502 for example 2022-01-07 10:17:19 Really depends on the BASIC 2022-01-07 10:17:45 ZX Spectrum BASIC is really really slow at some things, so I would have believed a tokenised forth was faster 2022-01-07 10:18:01 why is that? working with 16 bit pointers is especially slow on an 8 bit arch unless you have some hardware support 2022-01-07 10:18:07 And I can back it up with facts since I have a tokenised or non-tokenised (build option) forth for the spectrum that is much faster 2022-01-07 10:18:35 Made me smile seeing how much faster it was than BASIC, FORTH is a good model 2022-01-07 10:19:31 16-bit pointers are not that much slower as long as you have carry (and Z80 has actual instructions for 16-bit addition etc anyway) 2022-01-07 10:20:10 ya hard to make a one to one comparison. a lot of those BASICs use floating point. comparing an integer BASIC to forth would be more meaningful 2022-01-07 10:20:26 Spectrum BASIC uses a mix of integer/floating 2022-01-07 10:20:41 If it's an integer it uses integer ops, if it's fractional it uses routines for floating point 2022-01-07 10:20:54 thats neat 2022-01-07 10:21:50 I'm not talking about floating arith, just the integer stuff, control flow etc 2022-01-07 10:22:00 I never did floating point on my forth so I can't compare lol 2022-01-07 10:22:22 But the spectrum floating point stack is pretty much a forth float stack so maybe I'd just use that 2022-01-07 10:23:01 The floating point performance for the Spectrum ROM is not atrocious, I'm sure it can be faster but not sure I could make it faster 2022-01-07 10:24:37 I've never written floating point implementation in software and I'm not going to start now, fixed point is just fine for 8-bit 2022-01-07 10:24:54 32-bit fixed point calculations on that machine "ought to be enough for anyone" 2022-01-07 10:30:25 as fas as subroutine threading goes, you can just count the cycles - 6+6 for a JSR/RTS pair and INC/BCC/INC/BCC/JMP = 5+2+5+2+5 on modern 65C02 and 9 extra cycles on old 6502 2022-01-07 10:30:56 so 12 for subroutine threaded vs 19 or 28 for direct threaded 2022-01-07 10:31:31 and re floating point, it depends on what you want to do :) 2022-01-07 10:31:42 Also you get another register to use with sub threading 2022-01-07 10:31:54 But use more memory (on 8-bit, usually) 2022-01-07 10:32:17 assuming you have a 16 bit register to old the thread pointer :P 2022-01-07 10:32:46 im interested in calculators so i made my own decimal floats for my 6502 forth 2022-01-07 10:33:07 Also it's not a simple calculation because the real question is what percentage of time do you spend NEXT'ing, if it's like 50% of the time then your speed difference impact is halved 2022-01-07 10:33:11 But often it's even less 2022-01-07 10:33:33 The proof's in the pudding 2022-01-07 10:34:16 that is true though the original question was whether subroutine threading is faster on 8 bit. it clearly is at least for 6502. its a different matter whether the difference is meaningful 2022-01-07 10:34:56 Not in my opinion because the subject of performance is so skewed towards whether it's a meaningful speedup 2022-01-07 10:35:49 MrMobius, that seems about what I would expect. That subroutine threading is faster than direct threading. 2022-01-07 10:36:08 For 8-bit... on modern CPUs it's more complicated 2022-01-07 10:36:09 It was surprising to see the results where stc was 2 times slower than direct threading 2022-01-07 10:36:14 those are actually separated things. if you define performance or speed by the number of cycles it takes, there is no room for opinion. it's just an objective measure of cycles taken 2022-01-07 10:36:50 semantics 2022-01-07 10:37:40 you can define performance in a different way which is fine but if youre defining it by cycles then there is no room for disagreement. it's just the number of cycles 2022-01-07 10:38:02 Okay but what is the program we're measuring? 2022-01-07 10:38:12 You can't measure cycles without a program to run 2022-01-07 10:38:29 all programs. if everything else is the same except NEXT then it's the same calculation for all programs 2022-01-07 10:38:46 ie how many cycles does NEXT take 2022-01-07 10:39:04 Okay but be careful to not exagerrate the importance of NEXT, becaues if NEXT is twice as fast, that doesn't mean the FORTH will be twice as fast 2022-01-07 10:39:07 That is the point I am making 2022-01-07 10:39:35 I know you understand this, but just trying to make it clear for posterity 2022-01-07 10:39:58 thats a good point but its not relevant to this (i dont mean this in a mean way). thats why i said the original question was if stc is faster. that is an entirely separate concern although its important 2022-01-07 10:40:55 right 2022-01-07 10:41:27 In my opinion it's so important and is a fundamentally motivating question that there's something wrong with having the academic conversation about NEXT speed without also adding the disclaimer "this could mean a lot or very little depending on the program, and other things" 2022-01-07 10:42:04 i guess that can be said about most performance figures.. 2022-01-07 10:46:50 meh i think it's that's person's fault if they jump to that conclusion without anyone saying that 2022-01-07 10:48:21 I'm not trying to prescribe blame, just trying to work with the fleshy creatures I communicate with. Personally I have noticed the fleshy creatures are inherently bad at interpreting simple data and easily mislead by facts presented the right way 2022-01-07 10:50:50 good ol’ fleshy folks 2022-01-07 10:52:04 ya its a practical question 2022-01-07 10:53:23 It's a bit like saying "linked list dictionaries are slower than hashed dictionaries". It's true under every meaningful metric. It's also not a valuable fact to most FORTH implementors 2022-01-07 10:54:07 Well not quite the same but just babbling on now 2022-01-07 13:21:38 Hello everyone! I haven't really touched FORTH for some years, but recently I've decided to dabble a bit more in it. 2022-01-07 13:22:10 Could someone critique this small sample of code I just wrote? https://dpaste.com/BQUJVKHRR 2022-01-07 13:26:34 add more comments? 2022-01-07 13:27:05 Like a link to a WikiPedia article..? 2022-01-07 13:28:46 I am not an expert. What differentiates good forth programs vs bad forth programs is the use of stack operators. Good programs use the thesaurus and the program seems to flow with the words. With bad forth programs, all I see is stack manipulation operators. 2022-01-07 13:28:56 this is my opinion. 2022-01-07 13:29:24 have you read thinking forth? 2022-01-07 13:30:26 I might've, years ago.. I know I read Starting FORTH.. 2022-01-07 13:31:00 I'm aware of that, however, the algorithm itself is about as straightforward as my code. 2022-01-07 13:53:40 lagash: Hey that's some good syntax highlighting for FORTH there 2022-01-07 13:53:44 Will have to use that site 2022-01-07 13:54:24 That looks appropriate to me, it's true the calculation is a bit inherently complicated 2022-01-07 13:56:21 lagash: `dup 31 / swap 31 mod` is `31 /mod swap` 2022-01-07 14:03:29 veltas: nice! I wasn't exactly thinking of code golfing but this is pretty small :) 2022-01-07 14:04:05 Well in FORTH I sort of inherently try to code golf, especially if it's just a complicated calculation anyway 2022-01-07 14:06:17 I mean I'm sure some other stack-based language like GolfScript would make it really tiny but still.. 2022-01-07 14:25:51 I'm not trying to make it as small as possible in any language, I'm just trying to factor it in FORTH 2022-01-07 14:26:08 lagash: This is what I got trying it https://dpaste.com/B42QKN8LB 2022-01-07 14:26:37 So that is how I document a 'big calculation' 2022-01-07 14:28:08 veltas, I like your formulaic commenting style. cool. 2022-01-07 14:28:10 /mod was just for your info because I assumed you didn't know about it from the way your word turned out 2022-01-07 14:28:44 joe9: Yeah usually I don't put formulae in like that, but in this calculation I think it's useful 2022-01-07 22:36:39 https://github.com/Bushmills/Bashforth/