Felix 2018.09.16 Released
github.com1 pointsby Yttrill0 comments
reduce idem[T] (x:list[T]) : list[T] = x.rev.rev => x;
which says reversing a list twice leaves the original list, so just get rid of these two calls. ~/felix>flx --test=build/release --static mt
~/felix>time ./mt
real 0m0.004s
user 0m0.001s
sys 0m0.002s
~/felix>time ../lua-5.2.1/src/lua mt.lua
real 0m0.006s
user 0m0.001s
sys 0m0.003s for var i in 1 upto 15 do
println$
match i % 3, i % 5 with
| 0,0 => "Fizz-Buzz"
| 0,_ => "Fizz"
| _,0 => "Buzz"
| _ => str i
endmatch
;
done
Did I get the job?
The problem you're going to have is that if 10K goroutines all call PCRE you need 10K stacks, because all the calls are (potentially) concurrent.
What makes go work is that the compiler calculates how much local memory a goroutine requires and so after a serialised bump of the stack pointer the routine cannot run out of stack. Serialising the bump between competing goroutines is extremely fast (no locks required). Deallocation is trickier, I think go uses copy collection, i.e. it copies the stack when it runs out of address space on the stack, NOT because its out of memory (the OS can always add to the end), but because the copying compacts the stack by not copying unused blocks. Its a stock standard garbage collection algorithm .. used in a novel way.
The core of Go is very smart. Pity about the rest of the language.