00:00:00 --- log: started forth/20.10.06 00:22:12 --- join: mtsd joined #forth 00:26:00 --- join: proteus-guy joined #forth 00:26:07 --- join: proteus-person joined #forth 01:00:28 --- quit: C-Keen (Quit: WeeChat 2.8) 01:29:49 --- quit: proteus-guy (Ping timeout: 240 seconds) 01:30:20 --- quit: proteus-person (Ping timeout: 260 seconds) 01:42:05 --- join: proteus-person joined #forth 01:42:09 --- join: proteus-guy joined #forth 02:02:06 --- quit: alexshpilkin1 (Quit: Idle for 30+ days) 02:03:30 --- quit: reepca (Read error: Connection reset by peer) 02:13:12 --- join: C-Keen joined #forth 03:11:12 --- join: DKordic joined #forth 03:14:29 --- join: f-a joined #forth 03:33:36 --- quit: mjl (*.net *.split) 03:33:36 --- quit: kori (*.net *.split) 03:35:02 --- join: mjl joined #forth 03:35:02 --- join: kori joined #forth 03:41:47 --- quit: proteus-guy (Ping timeout: 240 seconds) 03:42:40 --- quit: proteus-person (Ping timeout: 272 seconds) 03:55:10 --- quit: zolk3ri (Remote host closed the connection) 04:00:23 --- join: zolk3ri joined #forth 04:04:29 --- quit: mtsd (Ping timeout: 240 seconds) 04:04:32 --- quit: f-a (Quit: leaving) 04:33:11 --- join: ptrkriz joined #forth 04:37:59 Hey. I am reading https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Singlestep-Debugger.html#Singlestep-Debugger and I input the same lines (: badword 0 DO i . LOOP ; and 2 dbg badword and I do get "Nesting debugger ready! [ 1 ] 00002 and "7F8EF8B16228 55ACC63D0479 0 ->" except after that if I press enter, I don't get what is shown there on this page. 04:38:48 I tried both and "n" 04:39:06 I don't seem to get the same output at all 04:39:16 when I press "n" I get "noname Code" 04:39:24 and it freezes 04:39:44 --- join: mtsd joined #forth 04:39:45 nvm, doesn't freeze, but nothing happens whatever I input 04:40:09 any clue why? 04:41:38 also why can't I proprly disassemble a word using "see"? I am expecting asm like I do with swiftforth... I do get asm when I use "disasm" or "discode" but no clue how I get the addr and what the "n" should be (params to discode) 04:53:52 --- quit: Zarutian_HTC1 (Remote host closed the connection) 05:43:15 ptrkriz: the singlestep debugger only works for me if invoke gforth as gforth-itc, otherwise i am presented with "Invalid memory address" and a backtrace - the first line of that page mentions "The singlestep debugger works only with the engine gforth-itc." 05:57:39 oh you are right, I missed that 05:57:48 what's itc? I'm new to forth 05:58:12 indirect threaded code 05:58:20 ah I see 05:58:34 thanks 06:00:15 sometimes it says "compiled" when I define a word, and then it starts doing it every time 06:00:19 not sure whats up with that 06:01:03 also you can't expect to see disassembled instructions for words that are composites of other forth words, you'll always get the forth code back, but you can get the execution token of such a word, dump the memory at the address, and try to make sense of the structure if you wanted 06:01:51 eg. see rot vs. see badword 06:03:00 yeah, how do I get the memory address of it, or how do I dump it? 06:03:08 and yeah I noticed that just a few mins ago 06:04:30 ' badword hex 100 dump 06:05:18 hmm how would I disasm or discode it tho? 06:05:44 how do I know the "n"? 06:06:01 that's just the length of the range to disassemble 06:06:48 this dump doesn't appear to contain valid instructions anyway, but that's not say the first machine word's worth of bytes aren't an address of an interpreter though 06:56:39 inode: and what's up with this "compiled" thing with gforth? 06:57:09 [ 32 1 - ] literal lshift compiled 06:57:17 then whatever I input, it says compiled 06:58:02 [ 32 1 - ] literal lshift compiled 06:58:02 .s compiled 06:58:52 I read "It's probably also worthwhile to change `32 FRAC – lshift` to `[ 32 FRAC - ] literal lshift` for a similar reason." so I wanted to try it out 07:00:49 so not sure how that works 07:08:10 [ ] aren't really useful outside of word definitions, [ enters immediate mode so you can calculate the result of something to include in your definition and ] enters the compilation state 07:09:15 so gforth assumes you're still compiling, until you give it ; or some error occurs and it tries to get back to some sort of sane state 07:11:35 [ enters interpret mode and ] enters compile mode 07:11:38 not immediate mode 07:12:17 : foo forth code here [ some math calculate here ] literal blah blah ; 07:12:20 ^ what he said 07:12:48 the switch from compile back to interpret allows you to do some calculation of some value at compile time instead of run time and compile it as a literal 07:13:31 and "literal" is an immediate word so even though its after the ] and you are back in compile mode it compiles the value you calculated as a literal 07:14:25 as for the "compiled" thing with gforth i dont use gforth, you couldnt PAY me to use a forth written in C 07:14:41 forths written in C are an abomination imho 07:15:45 why target C specifically? surely your distate includes forths written in any language higher than assembly? 07:16:12 distaste* 07:16:23 any non trivial application written in C will be 100 times larger than the euqiv forth 07:16:46 it will probably be smaller than Forth 07:16:48 if you write a forth for android in java im not going to like it but i probably wont hate on it the way i hate on C based forths 07:16:51 the same thing can be said for most lanauges 07:16:56 no i can guarantee it wont be 07:17:12 MrMobius, how big is the libncurses library? 07:17:21 mark4: what do you use? 07:17:41 mark4, it's difficult to write more than a line or two of unoptimized forth that is smaller than the equivalent optimized C 07:17:44 languages*, just the number of times larger in the source language changes 07:18:05 mark4, I have no use for that in embedded so I couldnt tell you 07:18:07 i use my own forths 07:18:36 MrMobius, its about 500k in size. my more powerful (tho being rewritten now) forth version of it was 8k 07:18:51 forth is orders of magnitude more space efficent than C is 07:18:54 do you have a forth library that does everything libncurses does to comare it to? 07:19:06 +p 07:19:13 for NON TRIVIAL applications 07:19:15 mark4: for x86_64? 07:19:20 for a few lines there wont be that much difference 07:19:43 --- quit: mark4 (Remote host closed the connection) 07:19:55 altho I wanna get a board 07:19:55 did he rage quit? 07:20:25 --- join: cox joined #forth 07:20:25 --- nick: cox -> mark4 07:20:26 i don't think so, he just does that 07:20:35 sorry internet problems 07:20:35 see, he's back 07:20:46 there he is 07:20:53 did i miss a reply? lol 07:21:06 no we definitely weren't talking about you behind your back 07:21:07 no I waited for youto return lol 07:21:16 kk 07:21:27 im a forth zealot and i HATE the c programming language 07:21:32 i have a forth buddy that says 07:21:47 "Developing embedded applications in C is like opening a can... WITH A ROCK!" 07:21:54 smash smash smash... gets the job done 07:21:55 I'd have to see exactly what the library is doing but it's doubtful an 8k forth library is doing the same as a 500k C library 07:22:18 mark4: is your stuff for x86_64? 07:22:25 well you can see the old version of it at mark4th/x4 on github 07:22:25 I tested this for the 6502 and Forth is easily 3x bigger than the C version and that is not even that good at optimizing 07:22:36 i just ported most of x4 to x64 on github :) 07:22:51 anyone know if there was any more development into WISC (writable instruction set computing) systems beyond CPU/32? 07:23:16 MrMobius, which 6502 forth? 07:23:33 what is a writeable instruction set? 07:23:58 ESP32 has user opcodes but thats the manufacturer who sets them 07:24:04 we should hold a #forth tournament: come up with some set of problems, and the forth zealots can write solutions in forth and those of us who like forth but also like other languages too can write solutions in other languages, and then we can debate for the rest of eternity over who won! 07:24:17 mark4, Tali Forth 2 which is an STC forth. creates much bigger programs than C and is around 20% as fast 07:24:36 although by far the fastest forth I have been able to find 07:24:49 mark4: an architecture that allows you to implement microcode that suits your desired programming language better than an assumed general purpose instruction set would, so that's at least what the premise was iirc 07:24:58 MrMobius, i might suggest that the 6502 forths you are using are maybe not verey good? :) 07:25:42 mark4, that's a backwards way of reasoning. shouldnt you look at the forths first without assuming that? 07:25:44 inode end users can modify the opcodes at compile / run time? or its an ARCh and the producer who licenses it can define opcodes? 07:25:57 mark4: the former 07:26:02 thats basically what the extensia arch does which is what the ESP32 is based on 07:26:07 im just getting into ESP32 :) 07:26:17 https://users.ece.cmu.edu/~koopman/forth/rochester_87.pdf 07:26:22 im writing an esp32 assembler in forth its about 99% complete 07:26:44 inode, I suggested that more than once but there were no takers at the time. hard data on C vs forth seems to be exceedingly rare... 07:27:01 MrMobius, maybe but even my 8051 forth was only 3k in size total 07:27:16 my av4 forth was 4k but it had a lot of fat in there thats not really needed 07:27:44 MrMobius: what would you consider to be good points of comparison? 07:28:10 how many cycles it takes to execute and how much space it takes 07:28:13 also, even if the forth was perfect the application implementation might not be 07:28:33 other things will mostly be opinion, so no objections if you like using forth even though its slower or you dont need it to be fast 07:29:12 MrMobius, im actually trying to devise a more efficient way of implementing structures in my forths, my 8k curses code could be 2k if i can do it 07:29:22 mark4, size of the kernal is one thing but the size of the resulting programs is what I mean by size 07:29:31 yes 07:29:43 MrMobius, i've never used it in anything serious but i always imagined i'd treat it like a scripting language: great for rapid prototyping and just getting the damn thing to work, and then you come back afterwards and optimize critical paths with code words 07:29:44 and application code size depends on many factors 07:29:58 MrMobius: fair enough, with these sorts of tests i wonder how you can eliminate the skew of the differences in quality between both languages 07:29:59 Cm says if its not at least 100 times smaller than the equiv c its not forth :)( 07:30:31 there are also MANY ways to skin a cat 07:30:35 MrMobius: fair enough, with these sorts of tests i wonder how you can eliminate the skew of the differences in quality between both languages *compilers* 07:30:41 I doubt that was true even in the good old days before optimizing C compilers 07:30:43 im not sure a STC forth is as space efficent as a DCT 07:30:44 or ITC 07:31:18 mark4, right. I would think it would be least space efficient but fastest (though also depends on architecture) 07:31:31 yes thats the tradeoff 07:31:53 --- quit: mtsd (Remote host closed the connection) 07:31:56 but the fastest model is still 5x slower than C, at least in the comparison I did 07:32:56 btw, when i showed what my curses lib could do to the ncurses dev he said that would be almost impossible in ncurses 07:33:10 i had multiple overlapping, moving windows with text scrolling in any direction 07:33:30 but im rewriting it to support utf8 now 07:34:53 inode, my take is that the quality of compiler is irrelevant. we can only test what exists. if something better could exist but doesnt, it's irrelevant until someone implements it 07:36:09 ie performance could be much better if more forths optimized but a lot of platforms dont have an optimizing forth 07:36:49 i dont actually see ANY need in the real world for optimziation down to the opcode level when the base language is naturally efficient 07:36:59 C without optimizations is HORRENDOUSLY inefficient 07:37:14 one look at the output of GCC at -O0 will show that 07:37:51 yes you can eek out a bit of performance optimizing at the opcode level but you get orders of magnitude better performance improvements simply by optimizing the way you do something 07:38:08 why does that matter? people generally have optimization enabled unless there's a good reason not to. -O0 is not a useful indication of anything 07:38:21 you heavilly optimized bubbles sort will be significantly slower than my unoptimized shuttle sort 07:38:30 and shuttle is just one step up from a bubble lol 07:39:03 mark4, but what happens when you get orders of magnitude better performance by optimizing the way you do it and it's still not fast enough? in that case you can do things with C that you cant with forth if there is still performance left that you need 07:39:11 MrMobius, i was developing an android NDK forth for armv7-a but was doing part of the JNI in C 07:39:17 optimized to -O3 or -O2 07:39:32 the code was HORRIBLE and im just talking 2 or 3 wrapper functions in C 07:39:36 like 2k total 07:39:48 i rewrote them in FORRh and got them down to less than 1k 07:40:07 C does not naturally lend itself to space efficiency 07:40:17 i wont question its speed efficiency 07:40:36 did you try it with -Os? 07:40:38 but... you almost NEVER need that kind of efficiency everywhere 07:40:40 yes 07:41:16 theres actually only a few small tweak differences betwen 2 and s optimization 07:41:23 sorry but you cant say you almost never need that kind of efficiency. that is highly dependant on what youre doing. you cant generalize that other people will use the languages for the same thing as you 07:41:36 MrMobius, ALMOST never. not NEVEr 07:41:55 its not even almost never 07:42:03 -Os is for size not speed 07:42:05 now. if you are writing world of warcraft you probably want the game engine pretty efficient :) 07:42:07 mark4: how were you gauging these sizes? entire resultant object size? or copying out the bare minimum required? 07:42:09 its for size i know 07:42:33 inode what ever the code size is within the resultant opbject well code and data use 07:42:47 i can pretty much beat any c compiler out there for space efficiency 07:43:07 and i dont consider myself 'expert" 07:43:46 i simply do not worry about speed efficiency accross 90% of my code. only in those places where its absolutely necessary 07:43:55 which after 30 years of embedded code are very rare 07:45:18 inode with my curses i look at libncurses.so and compare that to my 8k of used code space :) 07:45:35 ya i know a lot of that .so is glue stuff thats not part of the loaded image 07:46:47 with the arm64 abi i would say pretty much ANYTHING that does not follow it will be orders of orders of orders of magnitude smaller 07:47:04 2/3 of your code on aarch64 is going to be moving data from one register to another 07:47:25 ya thats usually the point people make when you crticize performance. recode the critical 10-20% in assembly 0_0 07:47:31 mov x, y mov a, b mov c, d ..... call function .... unwind those moves 07:47:42 MrMobius, yes 07:48:13 i never critisize performance, if you dont need it i dont waste my time giving it 07:48:23 so I guess it's a matter of preference if you'd rather do that or just write 100% in C 07:48:28 but you often do not know where you really need it till you try 07:48:47 99.9999999% of my career is C based :) 07:48:53 true but you also don't have to worry about that at all if you write in C. all that's left to think about is the algorithm 07:48:55 so naturally i pick -O2 07:49:23 except C is never... absolutely NEVER space efficient 07:49:28 it gets the job done 07:50:49 but in todays age, space efficiency is less of an issue 07:50:50 again, it depends on the architecture. C is about 30% bigger than assembly on 6502 and half as large as the STC forth 07:51:08 30% bigger than assembly is pretty space efficient to me 07:51:10 when your $6 development board has 256 megs of ram and 512 megs of flash.. . . 07:51:26 my biggest gripe against C is not is runtime efficiency or its size efficiency 07:51:33 its its development time inefficiency 07:54:46 --- join: Zarutian_HTC joined #forth 07:57:14 thats another thing that would be interesting to measure 08:02:52 --- quit: Zarutian_HTC (Remote host closed the connection) 08:03:17 ya but then again im 100% biased so my devel time in C is never going to be as efficient as my devel time in forth lol 08:03:42 we need to have forth only coders learn C, c only coders learn forth and then measure them against each other lol 08:04:02 p.s. please dont tell my agency or my employers i hate c :) 08:04:16 actually tho my manager knows im a forth fanboi :) 08:05:57 that would be interesting 08:06:16 I think I would compare the best C coders to the best forth coders 08:06:43 or some level of proficiency 08:08:19 my father told me a story taht i ahve not been able to verify but some time in the 1980's general electrics diesel electric division (make diesel trains) was trying to develop an ECU for engine diags 08:08:39 they hada team of devs working on it for years and when the manager said show me what you have they couldnt really demo it 08:08:50 so he hired forth inc and they came in and wrote the code in 2 weeks 08:09:07 i dont reamember the actual time frames of the story and i absolutely CANNOT verify that this story is true 08:09:13 but i believe it may be 08:09:38 right this is the type of story you hear a lot 08:09:44 yes 08:10:03 and people dont usually come out and say what they are implying because people would immediately criticize them 08:10:31 if i think it i say it and if you have critisism i TRY to listen lol 08:10:32 since the point of the story is other languages are so bad that it takes years and youre not finished whereas forth can do it in 2 weeks 08:10:54 which ignores all the other hypotheses like the team was just not good at programming 08:10:55 well it was a non trivial problem and i dont think C was a good choice 08:11:05 agreed 08:11:26 there are many variables we dont know even if this story is true 08:12:30 but i worked for siemens PTD (power meters) for a while and they were developing an in house C++ operating system to be used on all future products 08:12:36 why would you think C is not a good choice in that story? did your dad say they had limited ROM space in the ECU or something? 08:12:43 their OS filled up 98% of the available code spave 08:12:45 space 08:13:20 do not know what architecture it was. i just do not think C is an embeddable language. even embedded java can be more efficient 08:13:34 you can embed a java in a very small space 08:13:49 you can embed a forth in a very small space 08:14:11 at the expense of speed 08:14:13 and forth is naturally space efficient 08:14:20 which is not critical 08:14:24 so youre back to not generalizing since project requirements vary so wildly 08:14:25 and when it is... asm to the rescue 08:14:34 yes and no 08:14:40 im generalizing 30 years of experience :) 08:14:51 yes there are times when being efficient is critical 08:14:55 seems like a very bad idea :) 08:15:06 thats a very very small percentage of any applictions code 08:15:31 depends on the application 08:15:42 i think being more space efficient is more important than being speed efficient 99% of the time 08:15:57 when speed is critical you can code asm 08:16:06 wait, werent you the one just saying megabytes of space for $6??? 08:16:07 oh wait. nobody does that any more because "asm is not portable" bullshit lol 08:16:24 MrMobius, yea thats true TODAY lol 08:16:56 but we are using PIC32's here at cox and were 90% full and have a library that we need to add thats going to eat up about the same space 08:17:28 but were not using the MIPS16E optimization because we have to pay for that version of microchips compiler 08:17:46 ya I aggree thats a shame 08:17:59 I dont know why they do that 08:18:07 so... we have used up over 200k of code space on an application I could have written in forth in much smaller a space 08:18:15 err except that library which thers no way i could rewrite lol 08:18:22 they must have run the numbers and figured out the business they are chasing off is less than the profit they get from selling gcc 08:18:24 thats a full CAN stack lol 08:19:22 c doesn't have to be like that, though. i think a lot of language debates are probably really about culture underneath 08:19:25 not sure it's allowed at your work but you know you can get a fully optimizing version of gcc for free? 08:19:38 you can 08:19:48 I think microchip has to give you the source if you ask since its gcc. the MaxiMite or whatever it's called guys have a copy you can use 08:19:53 its open source but compiling the microchip c compiler from sources is a HUGE pain 08:19:56 so almost nobody has done it 08:20:12 it is open source but its not as simple as downloading and running make :) 08:20:50 and... if you get it wrong, even if you enable the 16 bit opcode optimization you have a almost working compiler for production code? 08:20:59 erm no. just pay for the one by microchip lol 08:21:03 thats where tye get you 08:21:04 they 08:21:21 i would much rater see a forth from forth inc here 08:21:54 i could teach everyone here forth and develop the entire application other than the can bus stuff from scratch in less time than its taking us to do this in C lol 08:22:01 its not rocket surgery 08:22:02 really 08:22:21 the ONLY non trivial bit of this entire project is the CAN stack and... were not evne using that part yet 08:22:26 that will be fun 08:22:33 well it "would" be fun lol 08:22:35 having everyone share the same global/local variables 08:22:47 namespace clash engage lol 08:23:03 that only happens with bad coders and that can happen in any language :P 08:23:11 thats why forht has vocabularies and headerless words 08:23:12 no it cant 08:23:19 it doesnt happen in almost any other language 08:23:53 like in C it doesnt matter what I name my local variables. you can reuse those names in your functions 08:24:22 forth does not have local variables at all unless you add a horrible extension to add them 08:24:45 and global variables and functions can be made headerless when they should not be public 08:24:55 depends. Leo Brody brags about "local" variables which in all other languages would be called "globals" 08:25:00 if you name your shit properly there will be NO namespace collisions 08:25:27 a local variable is stack based - forth stack items are not named 08:25:49 a named variable is in heap and can be a) properly named or b) made headerless 08:25:59 hmm, so youre talking about everyone having their own vocabulary and each person contributes only their chunk of headerless code to the combined project? 08:26:10 no 08:26:32 if you have an NVM lib and you have a UART lib and a foo lib and a bar lib 08:26:44 you can prefix all your global functions with the module name 08:26:53 you can put EVERYTHING in the same vocabulary 08:26:54 OR 08:27:06 you can create a nvm voc a uart voc a foo voc and a bar voc 08:27:14 mark4, no, thats not what he desrcibes in Starting Forth. a local variable is not on the stack. internally it uses ALLOT and is part of the dictionary. it's what he recommends if you have too much on the stack and arent going to PICK 08:27:16 but you should still properly name your functions within the vocs 08:27:45 local to him means in close proximity to the code that uses it lol 08:27:53 what do you name the variables that the functions use? vocabulary_function_temporaryvariable? 08:28:03 nothing 08:28:09 they are items on the stack and have no names 08:28:27 and when the thing you need is 4 levels deep? 08:28:40 if i have a ring buffer head pointer and tail pointer and count i might call them ring_head ring_tail or something 08:28:49 im actually a bit lazy about this most times lol 08:28:57 and if I have a word that also uses ring_tail? 08:29:02 what do you mean 4 levels deep? 08:29:59 I mean if I put 4 pointers on the stack and then have a loop that needs to access each of the 4 in turn, how do I do that without using variables? 08:33:10 2dup ? 08:33:21 or 4dup if you need it 08:33:59 and if later its 5 or 6 i should make a 5dup and 6dup word? 08:34:01 or you dont do A B C D then do 4 operations but do A a-op B b-op C c-op D d-op 08:34:08 then you need to rethink your forth 08:34:24 CM says you should try never need to access items on the stack deeper than 3 08:34:25 but 08:34:28 you do have PICk 08:34:32 so there are no problems where you would need to access 6 pointers in turn? 08:34:33 0 pick is a dup 08:34:35 1 pick is an over 08:34:40 2 pick ... N pick 08:34:49 you can make a copy of the Nth stack item and use it 08:34:52 isnt PICK something we're encouraged to avoid? 08:34:57 yes 08:35:03 but thats a RULE OF THUMB 08:35:19 rethink your order of operations so you dont need the 4th or deeper stack item 08:35:25 so you would use PICK instead of putting one of the 4 in a variable and using ROT for the other 3? 08:35:33 --- join: Zarutian_HTC joined #forth 08:35:53 im not anti variable 08:35:57 if thats a good solution use it 08:36:00 what if that's not possible? what if I need to access all 4 pointers because im outputting to a screen for example? 08:36:29 so then you do need variables in some cases and they do need to be local variables not just everything on the stack 08:36:30 2>r do something with the 2 items now at top of stack then 2r> and do something wth those 08:36:39 if you need to do it non destructively 08:36:47 2>r 2dup do-stuff 2r> 2dup do-stuff 08:37:33 but again. if your code is so complex it needs to access past the 3rd stack item it might be more efficient code if you rethought it 08:37:47 NOT always easy and if stack juggling works.... 08:38:01 maybe but you have to admit there are plenty of cases where that's just not possible 08:38:09 you might need a lot more than 6 pointers at once 08:38:15 but if your code is chock full of 2dup 2>r 3dup blah blah you absolutely need to rethink 08:38:45 no. thers never a place where you cannot rethink your methods.... there ARE cases where thats not an option though :) 08:39:11 the point is, you can get to a point I reached quickly in forth where you have a lot of 2dup 2>r nonsense and then refactor, refactor, refactor and are still stuck since there are problems where those two things will never solve it 08:39:39 --- join: f-a joined #forth 08:40:05 so you have to rely on variables, which is usually the best thing in my opinion if rethinking doesnt work 08:40:11 actually even in C i have found non trivial optimizations simply by doing that re-factor 08:40:31 yes but those variables do not need to be visible to the reste of the app 08:40:53 in my forths i have (headers to) to go headerfull 08:41:04 the headerless headers all exist right up until you 08:41:05 behead 08:41:09 then they are all gone 08:41:36 so basically you define a variable, use it in a word, then remove its head so other words can reuse the variable name? 08:41:44 yes 08:41:51 thats smart 08:42:00 i also do the same with functions 08:42:04 like in my assembler 08:42:05 also tremendously wasteful of memory but you may not care about that 08:42:25 where i have multiple opcodes that have the same encodingd except for one little bit i crate a compiling word for those opcodes 08:42:36 : foo: ... ... ... .. comma ... .. ; 08:42:42 123 foo: fud 08:42:46 234 foo: blah 08:42:58 foo: is headerless but the words i compile with it for the assembler are not 08:43:24 one of the extensions im planning 08:43:45 is a transient vocab that i can compile all words that are only needed at compile time 08:44:03 i.e. compile the CODE for those words into a separate buffer, not just the headers 08:44:12 then i can discard the code AND the headers for those words 08:45:00 why the code? are you inlining it from the buffer? 08:45:24 for example the above assembler opcode creating words 08:45:45 the word i use to CREATE an opcode is not used when i USE that opcode 08:46:01 well unless its a does> word but even that can be refactored you dont NEED to use does> foo 08:46:06 for example 08:46:12 : constant create , does> @ ; 08:46:13 or 08:46:20 : doconstant .... ; 08:46:33 : constant create , ;uses doconstant ; 08:48:09 so wheere i have a word in the assembler that just creates a bunch of nemonic words that have similar encoding that creating word is never used in the assembler itself 08:48:21 when you use those opcodes the word that created those opodes is deadwood 08:48:46 another example 08:48:58 struct: foo ...... ;struct 08:49:04 --- quit: Zarutian_HTC (Remote host closed the connection) 08:49:18 in my forth, all the items between struct: and the ;construct are created as CONSTANTS 08:49:32 those constants are utilized in the code that references that structure but 08:49:56 erm missed some info 08:50:06 i have variable foo and constant foo but i also have var foo and const foo 08:50:08 var is like value 08:50:22 but const creates a state smart immediate 08:50:42 so 0 const foo will create a word called foo that will compile itself as a literal 08:50:58 : blah .... foo .... ; would be the same as : blah .... [ foo ] literal ; 08:51:17 so... the definition for all those constants are NEVER actually referenced at run time 08:51:38 and for any code that uses a lot of structures.... that leaves a lot of deadwood i would like to be able to strip 08:52:58 --- quit: iyzsong (Read error: Connection reset by peer) 08:53:09 inserting the literal like that is really smart 08:53:24 I solved some of those problems with a python script 08:53:34 123 const foo 08:53:53 then all mentions of foo are replaced with 123, so nothing takes any dictionary space 08:54:44 begin_vars var foo var bar end_var 08:54:59 --- join: iyzsong joined #forth 08:55:11 what is this “python” you are talking about? 08:55:12 ( ͡° ͜ʖ ͡°) 08:55:21 which becomes CREATE vars1 2 CELLS ALLOT 08:56:03 then any reference to foo becomes [ vars1 0 + ] LITERAL and bar becomes [ vars1 2 + ] LITERAL 08:56:16 and variable usage goes from 2k down to only 90 bytes 09:01:32 ya 09:02:01 if you look at forth inc's STC code their optimizer converts all constants into an immediate move into a register 09:02:09 mov r0, 0x1234 09:02:30 if you look at t4 thats what i do there to 09:02:45 thats not a compiler optimization in my mind 09:02:56 im not changing the underlying code structure 09:03:18 it may not be an opitmiation at all if it's followed by mov r6,r0 :) 09:03:39 i dont do compiler optimizations, ill do things efficiently in the compiler but i wont change what you put 09:03:58 --- join: proteus-guy joined #forth 09:04:02 i toyed with the idea of doing a peephole but... meh 09:04:08 --- join: proteus-person joined #forth 09:04:39 I thought you said once your compiler optimizes? maybe you meant something different 09:05:19 no i dont optimize ever 09:05:25 ahh ok 09:06:09 I think a lot of slow down comes from not recognizing constants at compile time in forth 09:06:50 like : lshift5 5 lshift ; 09:07:15 or even better : lshift7 7 lshift ; 09:07:50 i HATE the words lshift and rshift lol 09:07:55 << >> is what i call them 09:07:57 and u>> 09:08:05 youre always shifting by a contant number but most forths will just treat that the same as shifting by an unknown number 09:08:15 its like why dont we call @ "fetch" and ! "store" 09:08:18 because thats not forth 09:08:29 if you cant read << and >> as shifting operations... . . . 09:08:49 so if youre on an 8 bit system without a barrel shifter, you get a loop with a compare and 7 left shifts which eats up 100+ cycles 09:08:52 : foo 10 some-variable store-valie-at-specified-address ; 09:08:54 ugh 09:09:15 yes >> and << and u>> all take a parameter 09:09:19 whereas a C compiler would recognize that shifting left 7 is faster if you swap bytes and shift once 09:09:23 if the parameter is ONE you use 2/ or 2* ur u2/ 09:09:35 wihch is 10-20x faster 09:10:05 and that trivial amount of performance improvement is... negligable 09:10:38 again, depends on the application. it is not negligible when those start adding up and that's something you need to be fast 09:10:47 that and a bunch of other little things that slow forth way down 09:10:51 then code it the way you want it to be coded 09:10:56 anway, just bringing that up as an obvious area yo ucould optimize 09:11:01 dont have the compiler hold your hand and be mommy for you 09:11:26 i can optimize my shift words to account for taht too 09:11:34 ok, then optimize this please : foo CONST_VAL lshift ; 09:11:53 i would optimize lshift internally 09:12:10 ok how? 09:12:10 except i wont i dont see the need for saving 2 clock cycles out of 300 trillion clock cycles 09:12:30 if shift is greater than 8 move bytes then shift.. as you stated 09:12:31 lol its not 2 cycles. its 100s of cycles vs 20 or so 09:12:38 every time you use lshift 09:12:43 insignificant 09:12:49 nope 09:12:51 unless you are on a 1mhz uC 09:13:05 not if thats part of the application that needs to be fast 09:13:35 such as? 09:13:47 show me your application that needs you to save CLOCK cycles 09:13:56 you need to change processor or rethink your code 09:14:17 if your chosen uC is not capable of handling the problem you have a problem 09:14:19 hah ok im going to put that on a plaque - "you need to change processor" 09:14:55 why put a more expensive processor in there if I could just write it in C and get the optimization for free? 09:14:59 your AVR is great but it cant compete with my ESP32 lol 09:15:03 I dont think your boss will like that solution 09:15:06 p.s. i love avr :) 09:15:31 we have that exact problem right now at work :P 09:19:26 if you give me an 8051 with 1mhz clock cycle and it takes 12 cycles per opcode and you give me 8k of flash and you need a full lora wan stack and some HUGE application.... you have no right to get PISSY with me when it wont fit :) 09:19:52 all i can do is say "you need to switch to a more powerful platform" 09:20:10 "but we have millions of dollars invesed in this product!" 09:20:12 that's a strawman argument that ignores my point 09:20:13 then you wasted it 09:20:14 start over 09:20:24 maybe to a degree 09:20:54 if you need to eek out clock cycles you are doing nobody any favors 09:20:56 literally 09:20:58 are there projects that can be done with a given chip in C but cant be done with the same chip using forth because it's not fast enough? 09:21:28 i wouldnt say 5x faster is "eeking" out anything 09:21:36 ive never seen any NON TRIVIAL application done in C that could not be done better in forth 09:21:37 never 09:21:58 thats not the question 09:24:38 here's another way of asking the question: are there projects where you could do it in forth with a particular chip but could have done it in C with a similar but slower and cheaper chip? 09:26:37 hang on doggie nagging 09:36:47 for trivial applications? 09:36:48 yes 09:37:00 for non trivial applications where an OS is needed ? 09:37:01 NO 09:37:01 never 09:37:36 evn on a 32u4 avr you can put a forth in the boot flash area and leave the rest to the application 09:37:45 in this case you want it to be a teathered forth tho 09:38:03 32u4 has 32k of code space. 8 of that is boot flash 09:38:09 24k for app 09:38:31 i would say a tethered forth would be way better for development time and perfectly capable at run time 09:38:42 you spend more money on development than you do on hardware 09:38:58 a USAF pilot has more money in his training than ANY of the aircraft he might fly costs 09:46:02 im talking about speed not flash size 09:46:20 surely youre not saying there are never cases where the program being 5x faster makes a difference? 09:50:35 5x faster over 100% of the code? or 5x faster over 5% of the code? 09:50:54 those 5% can be coded to be more efficient 09:51:27 even in an STC forth where the forth is compiled down to pure assembler you can be more efficidnt going to human written assembler 09:51:36 and calling that not portable is utter bullshit 09:52:15 i have never in 30+ years of embedded development seen any application where 100% of the code needed to be at blazing speed 09:52:30 even in games like wow things like the user interface can be coded in LUA 09:52:44 you will never convince me that LUA is even as speed efficient as optimized C :P 09:53:03 ive seen complete access control applications developed in 100% pure embedded java 09:57:41 youre dodging the question again 09:57:57 im not asking if there are cases where 5x speed up doesnt matter 09:58:07 I agree that there are 10:00:23 I just find it so strange that forth users usually wont give a straight answer on this 10:00:48 like if you ask just about anyone who does python if there are cases where python isnt fast enough they just say yes 10:02:14 and it doesnt mean that python is worthless and should never be used any more than admitting that sometimes you need the speed and should use C and sometimes you dont and can use forth 10:05:35 --- join: WickedShell joined #forth 10:08:18 --- quit: proteus-guy (Ping timeout: 260 seconds) 10:08:22 --- quit: proteus-person (Ping timeout: 272 seconds) 10:09:01 --- join: f-a_ joined #forth 10:10:16 --- quit: f-a (Ping timeout: 272 seconds) 10:10:26 --- quit: f-a_ (Client Quit) 10:10:43 --- join: f-a joined #forth 10:20:02 --- join: proteus-person joined #forth 10:20:34 --- join: proteus-guy joined #forth 10:20:46 i dont call c worthless 10:21:02 i am just saying i have never seen ANY application where forth would not have done the job better 10:21:06 erm non trivial application 10:27:02 * crc uses `fetch` and `store` instead of `@` and `!` 10:33:02 i know lol 10:33:29 i use 10:33:48 i use << and >> for shifts because those are universally known tokens 10:34:17 i dont need : shift-top-of-stack-right-by-N-bits .... ; in order to be able to read the sources 10:34:28 lshift and rshift are limp wristed names 10:34:34 << >> u>> 10:37:21 i dunno. looks too much like C to be safe 10:38:46 --- join: reepca joined #forth 11:16:49 --- quit: proteus-guy (Ping timeout: 240 seconds) 11:18:02 --- quit: proteus-person (Ping timeout: 272 seconds) 11:33:06 --- quit: f-a (Quit: leaving) 11:45:40 --- join: proteus-guy joined #forth 11:45:41 --- join: proteus-person joined #forth 11:58:24 --- join: Zarutian_HTC joined #forth 12:01:52 --- quit: gravicappa (Ping timeout: 256 seconds) 12:02:30 --- join: gravicappa joined #forth 12:26:29 --- quit: Zarutian_HTC (Ping timeout: 240 seconds) 12:49:49 --- quit: proteus-guy (Ping timeout: 240 seconds) 12:50:26 --- quit: proteus-person (Ping timeout: 256 seconds) 13:01:58 --- join: proteus-guy joined #forth 13:02:31 --- join: proteus-person joined #forth 13:10:37 --- join: Zarutian_HTC joined #forth 13:57:27 --- quit: proteus-guy (Ping timeout: 240 seconds) 13:57:35 --- quit: proteus-person (Ping timeout: 260 seconds) 14:26:46 --- quit: gravicappa (Ping timeout: 272 seconds) 14:53:23 --- quit: sts-q (Quit: -- PANIC -- The function `show_irc' expects one argument of type [irc], but it is given one argument of type [unit -> irc].) 15:07:43 --- quit: zolk3ri (Remote host closed the connection) 15:08:00 --- join: zolk3ri joined #forth 15:59:14 --- quit: Zarutian_HTC (Read error: Connection reset by peer) 15:59:36 --- join: Zarutian_HTC joined #forth 16:00:11 --- quit: Zarutian_HTC (Remote host closed the connection) 16:07:44 --- join: Zarutian_HTC joined #forth 16:23:29 --- join: 07IAAFG66 joined #forth 16:23:30 --- join: 17SAAXDNP joined #forth 17:22:53 --- join: dave0 joined #forth 17:27:47 --- quit: 17SAAXDNP (Ping timeout: 240 seconds) 17:27:54 --- quit: 07IAAFG66 (Ping timeout: 260 seconds) 17:41:39 --- quit: cp- (Quit: Disappeared in a puff of smoke) 17:42:30 --- join: cp- joined #forth 18:07:49 --- quit: Zarutian_HTC (Ping timeout: 240 seconds) 18:13:17 --- join: jsoft joined #forth 18:16:33 --- quit: a3f (Ping timeout: 272 seconds) 18:17:02 --- join: proteus-guy joined #forth 18:17:09 --- join: proteus-person joined #forth 18:20:01 --- join: a3f joined #forth 18:40:37 --- join: boru` joined #forth 18:40:40 --- quit: boru (Disconnected by services) 18:40:42 --- nick: boru` -> boru 19:14:45 --- quit: dave0 (Quit: dave's not here) 19:21:46 --- quit: proteus-guy (Ping timeout: 260 seconds) 19:22:00 --- quit: proteus-person (Ping timeout: 256 seconds) 19:24:55 --- quit: kori (Quit: WeeChat 2.8) 19:28:25 --- join: kori joined #forth 19:28:25 --- quit: kori (Changing host) 19:28:25 --- join: kori joined #forth 19:31:50 --- join: Zarutian_HTC joined #forth 19:32:29 --- quit: Zarutian_HTC (Remote host closed the connection) 19:33:10 --- join: Zarutian_HTC joined #forth 20:06:39 --- join: gravicappa joined #forth 20:21:43 --- quit: Zarutian_HTC (Remote host closed the connection) 20:40:22 --- join: sts-q joined #forth 20:44:42 --- join: proteus-person joined #forth 20:44:42 --- join: proteus-guy joined #forth 20:46:49 --- quit: sts-q (Quit: -- PANIC -- Insufficient space for garbage collection.) 20:57:15 --- join: sts-q joined #forth 21:06:05 --- quit: sts-q (Quit: ) 21:06:31 --- join: sts-q joined #forth 21:27:02 Hey is there any kind of gui shenanigans for forth? 21:27:19 Like semi cross platform stuff? 21:34:23 mark4: what do you mean by "where forth would not have done the job better" 21:34:48 you could replace that line with "where C++ would not have done the job better" 21:35:41 MrMobius: Yeah every language has their own strong and weak points. Python is slow relative to C but that doesn't mean it's worthless as you said, different goals. 21:36:43 I like to think of Forth as getting most of the metaprogramming capabilities of Lisp and most of the performance of C in 20% of the code 21:48:46 --- quit: proteus-guy (Ping timeout: 256 seconds) 21:49:20 --- quit: proteus-person (Ping timeout: 256 seconds) 22:10:22 --- quit: gravicappa (Ping timeout: 272 seconds) 22:34:45 I love Factor. 22:58:33 --- join: proteus-guy joined #forth 22:58:52 --- join: proteus-person joined #forth 23:14:40 --- quit: zolk3ri (Remote host closed the connection) 23:14:53 --- join: zolk3ri joined #forth 23:45:01 --- quit: proteus-guy (Remote host closed the connection) 23:45:01 --- quit: proteus-person (Remote host closed the connection) 23:59:59 --- log: ended forth/20.10.06