devyn changed the topic of #elliottcable to: yorickpeterse is undergroin
fwg has joined #elliottcable
fwg has quit [Changing host]
fwg has joined #elliottcable
yorick has quit [Remote host closed the connection]
fwg has quit [Ping timeout: 252 seconds]
fwg has joined #elliottcable
alexgordon has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
eligrey has quit [Quit: Leaving]
joelteon_test has joined #elliottcable
joelteon_test has quit [Client Quit]
joelteon_test has joined #elliottcable
joelteon_test has quit [Remote host closed the connection]
joelteon_test has joined #elliottcable
joelteon_test has quit [Remote host closed the connection]
<devyn> joelteon: if you understand what TCO does, it's pretty obvious :p
<joelteon> yeah
<joelteon> i do
<joelteon> see i wrote this program when i was 17, and it's 5x faster than one I'm writing now for the same purpose
<devyn> not only that but without TCO, with enough recursion, your stack will overflow
<joelteon> i think it's because it's not using the list monad
<joelteon> but i don't really know
<devyn> nah, you just wrote it in a way that prevented TCO from working I'm sure
<joelteon> what i do know is `search' is entered ~20 times per word in this program, and exactly twice per word in the old one
<joelteon> and i don't know why
<devyn> if it's written such that the function must be reentered i.e. the return value isn't just the return value of recursive call
<devyn> then you can't TCO
<joelteon> well that's kinda how the list monad works
<devyn> for example f x = f (x - 1) + 5
<devyn> the + 5 prevents TCO
<joelteon> let a (a:as) bs = a as (a:bs)
<devyn> well yes you can easily get into trouble with monads, but it's possible to recurse with monads
<devyn> wait, perhaps that isn't what I'm talking about
<joelteon> tail recursive
* devyn reads
<joelteon> is what I was *trying* to do
<joelteon> is what i AM trying to do
<devyn> I was playing F1 earlier and my graphics card suddenly started spewing artifacts on everything
<devyn> quit the game, restarted, kept happening
<devyn> luckily it was just driver corruption; I just restarted and it reset
<joelteon> ok, this is FUCKING WEIRD
<joelteon> i need to look at the definition of State
<joelteon> because there is one recorded entry into g
<joelteon> and 1000001 into f
<joelteon> even though they both recurse
<joelteon> but the call to f is much faster
<devyn> my gigantic desktop with 9 fans is quieter than my laptop at minimal load
<joelteon> so they're basically the exact same speed
<joelteon> fuck this i give up
<devyn> lol
<purr> lol
<devyn> what exactly are you trying to optimize
<devyn> and why does it need to be
<devyn> lol
<joelteon> because i'm trying to figure out why my really poorly written program from 2 years ago
<joelteon> is 5x faster than the one i'm writing now
<devyn> ah
<devyn> can I see them? (gist)
<joelteon> sure
<joelteon> well
<joelteon> unscramble is the package i've written already
<joelteon> it's on hackage
<joelteon> and it's on github i think
<joelteon> and this one is just one program
<joelteon> one file
<joelteon> *
<joelteon> sec
<devyn> well the one on GitHub is a lot more readable haha
<joelteon> it sure is
<joelteon> i don't even understand how find works
<joelteon> seriously dont
<joelteon> but the one on github is written retardedly
<joelteon> it's like
<joelteon> "take this word, find every possible list of coordinates that contain those letters, then figure out which ones are paths"
<devyn> what do you mean you don't understand how find works? it's just like Ruby's Array#find
<joelteon> no
<joelteon> the find i defined as part of search
<joelteon> in the gist
<devyn> ah lol
<purr> lol
<joelteon> and the one in the gist is "take this letter and the next one, figure out whether any of the neighboring tiles have the next letter, and if not then bail"
<joelteon> and it's about 5x slower
<devyn> apparently I didn't have profiling libs installed
<devyn> so.... sigh, doing that
<cuttle> devyn, joelteon: laziness can alleviate that problem with lists and monads
<cuttle> laziness can prevent you from blowing up in recursion
<joelteon> sure i guess
<cuttle> and also if the compiler knows +5 is associative, it can do TCO. I know Refal does that with list-consing
<cuttle> but i mean that's not really a general solutoin
<cuttle> "suffiently advanced compiler" is not a good thing to rely on
<devyn> yes
<devyn> joelteon: wait so this gist is the new one? I thought you weren't using the list monad anymore
fwg has quit [Ping timeout: 272 seconds]
<joelteon> no, i started using the list monad
<joelteon> the old one uses a weird state monad thing
<devyn> ahh
<devyn> heh
<devyn> hm
<devyn> isNeighbor (x,y) (a,b) is True even if (x,y) == (a,b)
<devyn> that should most likely be False
<devyn> ?
<joelteon> whoops
<joelteon> ok, fixed that
<joelteon> it was not The Solution though
<devyn> yes I know
<devyn> still looking
<devyn> joelteon: ok so is the whole point to find a path through the grid to make a word?
<joelteon> yes
<joelteon> REALLY FAST
<devyn> :p
fwg has joined #elliottcable
fwg has quit [Ping timeout: 260 seconds]
* whitequark was dreaming about a cat who got a concussion and perhaps something worse
<whitequark> I wanted to call an ambulance so I put him into the fridge to minimize damage
<devyn> o_O
<whitequark> but then actually forgot about it
<whitequark> so I opened it in about a day, and voila, the cat was fine!
<devyn> I love dreams
<whitequark> also there was a fragment about Swiss embassy being located on top of a 1000-ft pole, inside which there was a gigantic arms exhibit
<whitequark> I'm not sure how was it related, but *it was*
<devyn> hahaha, I feel like I've had a similar dream, about a building on top of a pole
<whitequark> ooooh and you had to weld your hard drive to thousand others in order to pass it through
<whitequark> on that fucking pole
<whitequark> ...
<devyn> wat
<whitequark> exactly
<whitequark> it even had a name there, "nettle"
<whitequark> what the fuck does that even mean, let me look it up
<whitequark> ...
fwg has joined #elliottcable
devyn changed the topic of #elliottcable to: 22:53:14 <+whitequark> also there was a fragment about Swiss embassy being located on top of a 1000-ft pole, inside which there was a gigantic arms exhibit
<whitequark> and by gigantic I mean, just like in game of thrones
<whitequark> even though I don't quite recall whether there *was* a gigantic arms exhibit there, you still see what I mean
<devyn> so the swiss are preparing for air warfare by throwing knives
<joelteon> i had a dream where i was in breaking bad, but it had an alternate ending
<joelteon> i lived on a beach
<joelteon> at the end of the show, a bunch of aliens showed up and started killing everyone
<joelteon> well, not aliens
<joelteon> but like
<joelteon> well, i assume they were aliens
<joelteon> they were all in big ships
<joelteon> and the military tried to kill them but
<joelteon> it didn't work out
<joelteon> i lived with some woman on the beach, and one time i think i got in trouble or something
<joelteon> oh no, wait, her house got robbed by like 5 people
<whitequark> you should have put your cat in the fridge
<joelteon> and they found me in it, tied me up, and left me in there
<whitequark> that never goes wrong
<joelteon> for 18 hours
<joelteon> and stole all her shit
<joelteon> and as a punishment for letting them steal her shit
<joelteon> she knocked me out with drugs and took me to the hospital and had my anus surgically removed
<devyn> if you had put your cat in the fridge
<joelteon> and then after that i went to go live with my dad
<devyn> perhaps she wouldn't have removed your anus
<joelteon> and for some reason I was *really* mad at him
<joelteon> for losing my anus
<joelteon> and using a colostomy bag
<joelteon> so i ran away
<joelteon> ended up on a highway
<joelteon> that's when the aliens showed up and started killing everybody
<joelteon> i'm not making any of this up
<joelteon> longest, weirdest, most emotionally intense dream i've ever had
<whitequark> when I was eight or something, I dreamed that I was awake, and accidentally pulled my guts out, under the blankets
<whitequark> and then someone asked me to go somewhere, and I started making up excuses, because I was afraid of punishment
<whitequark> it was weird
fwg has quit [Ping timeout: 240 seconds]
fwg has joined #elliottcable
<whitequark> cuttle: re llvm-general, wanna talk about it?
<devyn> joelteon: ok, I've thought of a way to make this TCO-friendly
<devyn> writing it now
<joelteon> ok
<devyn> joelteon: it's way faster now. I'm just verifying that I haven't done anything done
<devyn> dumb*
<joelteon> i'm pretty sure i'm retarded
<devyn> how so?
<joelteon> because you made it way faster
<devyn> yeah but I had to basically rewrite it
<devyn> it's just a different algorithm
<devyn> that's all
<joelteon> ok
<joelteon> sooooooooooooooooooooooooooooo
<joelteon> maybe i'll one day see it
<devyn> joelteon: I'm going to gist it lol just wait
<purr> lol
<devyn> I'm just checking it over
<joelteon> ok
<devyn> joelteon: how long does it take your old one to do the same thing? the one on GitHub?
<joelteon> .208 seconds or something
<joelteon> i think
<devyn> oh :/ this doesn't come anywhere near that
<joelteon> wait, no
<joelteon> .372 on the same dictionary
<joelteon> my mistake
<joelteon> i'll go run it now
<joelteon> ok, 0.268 seconds
<joelteon> and yours is
<devyn> oh I measured wrong heh
<devyn> I had profiling enabled and stuff
<devyn> and wasn't compiling with -O2
<devyn> now I get 0.29s
<joelteon> nerd
<devyn> so what do you get on your CPU, then
<devyn> that's the question
<devyn> ghc -O2 --make unscramble of course
<joelteon> hang on
<joelteon> 0.423 for me
<joelteon> how fast is your CPU
<devyn> AMD FX-8320 running at stock, which I think is 3.1 GHz
<devyn> FX-8120*
<devyn> not 8320
<devyn> oops
<joelteon> ok
<joelteon> well
<joelteon> huh
<joelteon> amazing how that happened
<devyn> joelteon: if you run it several times does it change?
<joelteon> yeah it hovers around .410
<devyn> and the old one is definitely .208 on the exact same grid and dictionary?
<joelteon> yep
<joelteon> it also has a very minor IO overhead because it has to read the grid from stdin
<devyn> ok... I'll see whether I can do better, then
<joelteon> i know right
<joelteon> wtf
<devyn> 21:37:50 <+joelteon> "take this word, find every possible list of coordinates that contain those letters, then figure out which ones are paths"
<devyn> I really, really don't see how that could possibly ever be faster
<joelteon> me neither
<joelteon> maybe that's not what i'm doing
<joelteon> i must be crazy
<joelteon> actually, not only that, but unscramble also sorts the words by descending score
<devyn> ditching Set brought it down very, very slightly
<devyn> lol
<purr> lol
<devyn> oooooh
<devyn> I got something!
<devyn> adding walk [] _ = Nothing as a special case
<devyn> brought it down about 0.1 second
<devyn> wtf, GHC. in what world is specifying every single possible neighbor and then testing equality just as fast as doing it mathematically
<devyn> it should be slower
<devyn> o_O
<whitequark> maybe it just sucks at math
<devyn> nah, I'm just suspicious of the abs function
<devyn> yeah, getting rid of abs seems to have helped. probably was causing an actual function call
<devyn> I think this is as good as it's gonna get, at least with this method... try it out
<devyn> (by the way, the initial reading of the dictionary appears to be very heavy)
<devyn> ^________________________________________^
<cuttle> whitequark: sure yeah, that'd be good
<whitequark> cuttle: so the idea behind llvm-general is that there are two interfaces
<whitequark> one is impure, and it just wraps the underlying C functions with monads
<whitequark> other one is pure. it represents LLVM IR as an AST (pretty much) and you can build it and then serialize into actual IR objects
<whitequark> or deserialize
fwg has quit [Ping timeout: 272 seconds]
<whitequark> what do you want to do with LLVM?
<cuttle> whitequark: I want to write a language in haskell, compile to llvm
<devyn> cuttle has lots of crazy language ideas all the time, and presumably he's tired of writing interpreters
<devyn> :)
<whitequark> cuttle: ok, so you probably want to assemble an IR AST with llvm-general-pure
<cuttle> yeah, it just seemed like it would be stupid not to leverage the work llvm represents
<whitequark> then call LLVM.General.Module.withModuleFromAST
<whitequark> and LLVM.General.Module.writeBitcodeToFile
<cuttle> all right
<cuttle> so I was reading the kaleidoscope tutorial, and the nes recompilation tutorial
<cuttle> to learn plain old llvm
<cuttle> and I was wondering how to map that to the AST thing
<whitequark> I deem the specific syntactic details irrelevant, as suitable for Haskell :p
<whitequark> oh, hm
<whitequark> both of them simply build the IR without any funky mutation or querying
<whitequark> so the translation should be straightforward. what is not clear?
<whitequark> you'd basically replace every LLVMBuild* call with an ADT constructor
<cuttle> yeah, I feel dumb but I literally couldn't find the ADT constructors in Haddock so I don't know where to begin :P
<cuttle> like, which source do I look at
<cuttle> I guess I was looking at llvm-general, not llvm-general-pure
<whitequark> yep
<devyn> looks really great
<devyn> that has no docs though; follow the link
<cuttle> devyn: oh ok
<cuttle> thanks
<devyn> :)
<cuttle> ok cool
<cuttle> this looks good
* whitequark looks at freertos and sighs
<cuttle> time to learn plain old llvm for real now
<whitequark> "yay, it's just five files, that's nice!"
<cuttle> whitequark: hm?
<whitequark> "oh fuck every single one of those is 100KB of C spaghetti"
<whitequark> cuttle: hm? ?
<whitequark> I'm porting rust to bare metal
<whitequark> pxList->xListEnd.pxPrevious = ( xListItem * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
<whitequark> -_-
<devyn> whitequark: jesus, you aren't kidding
<cuttle> haha awgh
<devyn> looking at it now
<whitequark> well, it's not bad really, it's mostly whitespace and comments
<whitequark> freertos is pretty simple both conceptually and internally
<whitequark> it's also about as verbose as java
<whitequark> #if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
<devyn> yes, their naming scheme is really ugly
<whitequark> I'm in favor of using it though
<devyn> this looks like the kind of code you'd absolutely have to use an IDE to write if you wanted to get anywhere quickly
<devyn> lol
<purr> lol
<whitequark> combine weak typing of C with hardware engineers and the result is a disaster
<whitequark> those people are taught to get shit done, not proper software architecture
<devyn> mm
<devyn> their usage of caps seems... odd
<devyn> lots of types are like portBASE_TYPE
<devyn> but then they have functions like listIS_CONTAINED_WITHIN
<devyn> but not all functions are like that
<whitequark> that's a macro
<devyn> some are like xTimerIsTimerActive
<devyn> oh ok
<devyn> that makes some sense then
<devyn> also: xTimerIsTimerActive
<devyn> redundancy much
<whitequark> hungarian notation
<whitequark> a rather extreme form of it
<devyn> I'm aware
<devyn> but xTimerIsActive is perfectly fine
<whitequark> here, it's a replacement for typechecker :p
<whitequark> see, freertos's codebase is written in an incredibly rigid way
<whitequark> some of that to ease recognizing the types
<whitequark> some of that to aid mechanical verification tools they eploy
<whitequark> *employ
<whitequark> stuff like: /*lint !e946 MISRA exception justified as comparison of pointers is the cleanest solution. */
<whitequark> google MISRA
<whitequark> it's a standard which basically says which 80% of C you cannot use without some good justification
<whitequark> or if your car crashes into a wall and kills someone, you'll be raped with a broomstick
<devyn> heh
<whitequark> devyn: you'll like listLIST_IS_EMPTY
<devyn> hahahah
<devyn> I wonder if they have a parser somewhere that makes it worthwhile to write things that way
<whitequark> that is likely
<whitequark> a linter.
<whitequark> I do admit the style is kinda anal and hard to read, especially if you're not accustomed to it
<whitequark> MISRA also forbids the usage of recursion completely
<whitequark> take that, you functional zealots!
<devyn> to be fair there's rarely a good reason to use recursion in C
<whitequark> especially in embedded
<whitequark> gah. half of freertos ideally fits into rust's execution model
<whitequark> the other half does not fit at all
<devyn> I keep reading freertos as FREER-toss
<devyn> I don't know what a freer is
<devyn> :p
<whitequark> it's freer than that other toss
<whitequark> fuck, freer looks kinda alike to fryer
<whitequark> and that is related to food
<devyn> are you hungry again
* whitequark chews his laptop
<purr> lolmythesis
<devyn> hahaha
<whitequark> is it just me
<whitequark> or does it excellently demonstrate the ultimate superiority of hard science?
<devyn> how so?
<devyn> hahahaha
<devyn> "You can make spacetime do all kinds of wonderful things, and all you have to do is get rid of the conservation of energy.
<devyn> -- Physics, Tufts University.
<purr> Let it be known that devyn hates Physics, Tufts University..
<devyn> bah
<devyn> ++ Physics, Tufts University.
<purr> Let it be known that devyn is indifferent to Physics, Tufts University..
<devyn> >_>
<devyn> "Rats will go to great lengths to earn a pellet of sugar, and even more so when on the right kinds of drugs."
<devyn> "This is a weird star cluster and we absolutely have no idea how it formed - sorry."
<whitequark> HAHAHAHA
<whitequark> Built software development tools for an alternate reality that forked off in 1980.
<whitequark> Computer Science, University of Bern
<devyn> I saw that one too
<devyn> hahaha
<whitequark> that is so fucking spot on
<whitequark> static INF_BUF: [u8, ..3] = ['i' as u8, 'n' as u8, 'f' as u8];
<whitequark> *cringe*
<devyn> that pattern appears to show up in source a lot...
<devyn> test/bench/shootout-k-nucleotide.rs:static TABLE: [u8, ..4] = [ 'A' as u8, 'C' as u8, 'G' as u8, 'T' as u8 ];
<whitequark> yeah
<devyn> why?
<whitequark> static.rs:3:13: 3:16 error: bare `str` is not a type
<whitequark> static.rs:3 static foo : str = "foo";
<whitequark> I guess it will have to be special-cased
<devyn> wow, apparently cmr has put quite a bit of work into rust... I didn't know that
<devyn> I know him somewhat well
<whitequark> oh?
fwg has joined #elliottcable
fwg has quit [Ping timeout: 252 seconds]
yorick has joined #elliottcable
sharkbot has quit [Remote host closed the connection]
sharkbot has joined #elliottcable
Sgeo has quit [Read error: Connection reset by peer]
Sgeo has joined #elliottcable
fwg has joined #elliottcable
fwg has quit [Quit: gone]
fwg has joined #elliottcable
fwg has quit [Remote host closed the connection]
yorickpeterse has quit [*.net *.split]
cuttle has quit [*.net *.split]
fwg has joined #elliottcable
yorickpeterse has joined #elliottcable
cuttle has joined #elliottcable
fwg has quit [Ping timeout: 252 seconds]
<whitequark> ohmyfuckinggod food
<whitequark> it is amazing. fresh, tasty, delicious, yummy, palatable
<whitequark> and just good
<whitequark> protip: forget to eat
eligrey has joined #elliottcable
alexgordon has joined #elliottcable
fwg has joined #elliottcable
niggler has quit [Quit: Computer has gone to sleep.]
fwg has quit [Ping timeout: 240 seconds]
fwg has joined #elliottcable
niggler has joined #elliottcable