<veltas>
By the authors, interesting case of programming language design
<tpbsd>
naturally to control any machinery with a computer, programming is needed
<veltas>
Lua is a replacement for a DSL that was pretty much a Brazillian dBase replacement with simple validation on input
<tpbsd>
aha
<tpbsd>
I'm not interested in Lua now, I tested it on embedded but it's unsuitable for me
<tpbsd>
I also tested micropython
<tpbsd>
eLISP
<tpbsd>
nothing is as suitable as Forth which is substantially smaller and faster than all of the above
<veltas>
luajit is probably faster than Forth but how often does that matter
<tpbsd>
Forth is perfect for small embedded I'm my opinion
<veltas>
And it is very platform specific
<tpbsd>
in my tests Forth is about 3x slower than C
<veltas>
luajit is the reason Lua has as much interest as it does, a small project produced a JIT compiler that is better than the mainstream JavaScript JITs
<tpbsd>
but then Forth is interactive and the compiler is built in
<veltas>
Hmm
<tpbsd>
so a 19kB Forth also includes the compiler
<tpbsd>
no PC is needed
<tpbsd>
you could use a dumb terminal, tho no one does thesedays
<tpbsd>
the Forth development environment I use definitely needs a pc tho
<MrMobius>
tpbsd, 3x faster on m0 for example?
<tpbsd>
MrMobius, yes, thats what I used for my test
<tpbsd>
3x kept happening when I did comparisons and it's been mentioned in other literature
<tpbsd>
but it's still only anecdotal in my case
<tpbsd>
I find Forth on M3 is 3 - 4.8x faster than a M0 also
<MrMobius>
tpbsd, interesting. im doing a C to forth comparison myself now
<MrMobius>
did you use -o3 or -os?
<tpbsd>
MrMobius, cool, be interesting to see your results
<tpbsd>
I think I used the one that resulted in smallest code
<MrMobius>
-Os then probably
<tpbsd>
yes I think that was it
<tpbsd>
my initial tests were mainly about binary code size
TwoNotes has joined #forth
xek_ has joined #forth
xek has quit [Ping timeout: 240 seconds]
<veltas>
Fiance is learning programming, doing a Python tutorial. Did anyone here learn Forth as their first programming language?
<Kumool>
pretty sure v8 is now equal to lua, but it required an entire team to produce a jit while lua was just one person
<veltas>
I wonder how e.g. gforth compares to gcc
<Kumool>
it doesn't
<Kumool>
gforth is slower
<veltas>
I know Forth is generally slower
<veltas>
Although I can imagine that it could be as fast as or faster
<veltas>
I know often JITs can be faster than compiled languages, so going off of that principle
<Kumool>
you planning on building a JIT forth or something?
<veltas>
No
<Kumool>
I haven't written much forth, but I did try euler problem one in many forths, the fastest one was ficl, all the other ones were slow
<Kumool>
slower than lua
<Kumool>
not luajit either
<veltas>
Hey lol that is what I was doing to learn Forth at the start
<veltas>
Project Euler stuff
<Kumool>
I didn't know how to use big numbers in forth so I gave up
<veltas>
I just googled it and referred to gforth docs
<veltas>
And then for arbitrary length integers I stopped and decided I would write my own eventually
<veltas>
There is a big int for forth, I've seen it on github
<kori>
JIT forth, now that's an idea
<veltas>
Well by JIT forth all I mean is optimising your words
<MrMobius>
seems like the benefit of a JIT to forth would be a lot less since youre not using many registers
<MrMobius>
since one thing a JIT apparently does is decide what gets put in registers and what goes elsewhere like the stack
<MrMobius>
(not a JIT expert though)
<veltas>
Yeah but that is a good description for a normal language
<MrMobius>
what do you mean?
<veltas>
In Forth I think a lot of effort would go into figuring out which stack operations can be optimised out, and which stack contents can be done with registers instead of actually going to a stack
<veltas>
An example is a function uses >R and then R>, well '>R' might as well just write to a register
<veltas>
A word I mean sorry I can't break the habit
<Kumool>
http://ficl.sourceforge.net/index.html Ficl also features blindingly fast "just in time" compiling, removing the "compile" step from the usual compile-debug-edit iterative debugging cycle.
<Kumool>
my code doesn't work in it... the hell
<veltas>
Forth is actually highly optimised inherently... for space. And that matters a lot more to me on my 8-bit computers.
<MrMobius>
veltas, compared to what though?
<veltas>
Did anyone here learn Forth as their first language?
<veltas>
MrMobius: compared to native languages and assembly
<Kumool>
I don't know what its doing, I just know its faster and has better performance than gforth
<Kumool>
or it had, except now it doesn't work for some reason
<Kumool>
wtf
<veltas>
I am still enjoying Forth more than any other language in a while
dys has quit [Ping timeout: 260 seconds]
xek_ has quit [Ping timeout: 260 seconds]
<MrMobius>
veltas, neat. which 8 bit system?
<veltas>
ZX Spectrum
<MrMobius>
nice
<kori>
the zx spectrum would probably be nicer if it wasn't for the keyboard
<Kumool>
its in pure lua, but its not gonna look great, because you're trying to hijack the parser
<Kumool>
well, it looks fine, but still
<Kumool>
also awesomerc.lua is not a DSL either, its pure lua... you can easily build a DSL in lua though, I built one for vis by just editing its visrc, the same could be done for awesome if you wanted to and make it more legible or just not use lua at all