Skip to main content

Mike Kreuzer

Butthurt fanboys (Goodbye to all that)

October 8, 2018

Yesterday's post about the swirling chaos that lies beneath the prim facade of Elixir went down about as well as could be expected.

Lots of handwaving about solid foundations & ancient Swedish telephone systems. Lots of questions about why I'd dare to peek behind the curtain and not just use a prebuilt Elixir wrapper like a good boy. Even claims that Erlang's documentation is in fact good.

Hahahahahahahahahahahahahahaha. (It's not.)

Oh well, let the Erlang tail wag the Elixir dog. Those dead-enders have nowhere else to go & nothing else to defend. Time for me to move on to another adventure.

Tags:

Urlanguage

October 7, 2018

Ruby's slow. I hear that all the time. All. The. Time. So I decided to rewrite the Ruby script that generates Ripley (the Reddit programming language index) to try & make it faster.

The script that generates the Ripley stats has two main parts:

I already thought Ruby was pretty fast for the second step, two or three milliseconds is all that takes on my laptop which is plenty fast enough. I had my doubts about the first step though.

While I was benchmarking it I got rid of an external dependency, not because there was anything wrong with it, but because it dealt with the Reddit API and that's the core business of this script… and while I was doing that… I also rewrote that code in Elixir assuming it would be much faster. Elixir's known for not being slow in as much as it's known at all. So Elixir should've been be faster… Turns out no.

The Elixir code is about that same speed as Ruby. Once you're hitting the network concurrently it seems the limiting factor is the network speed and not much else. Ruby and Elixir both took between two and four seconds to scrape the 66 language subreddits I'm now looking at, with Ruby (randomly) getting the fastest time. The concurrent-ruby gem is the key to that.

Elixir offers a lot of things for bigger, longer running apps, supervision for example. But supervision is overkill for such a small task, and while

Task.async(fn ->

is not much trickier than

Concurrent.dataflow do

underlying any Elixir code you write is Erlang. Erlang, in all its subterranean eldritch horror. I made get & post requests with Erlang's :httpc.request – which it turns out has four parameters…

:get, {url, query}, [], []

and

:post, {url, headers, content_type, body}, [], []

both seemed to work, but I had to work that out, you wouldn't know it from the "documentation". I'd show the rest of the code but working out those parameters really was most of the effort.

Erlang's "documentation" like all of Erlang is comically user hostile.

Erlang's :httpc offers a timeout which is probably handy, but not much more, and the main pain point once I worked out how the thing worked at all was probably having to turn strings into character lists – [73, 32, 115, 104, 105, 116, 32, 121, 111, 117, 32, 110, 111, 116] – so all up moving to Elixir seemed to cost nothing much, but also to offer nothing much…

Unless there's something lurking in that "documentation." Is there? What's that, what even is… *screams*

Site seeing

September 17, 2018

Over the past few years I've got into the habit of tweeting links to things I've found interesting or noteworthy, but rather than continuing to throw them out there randomly I thought I'd group them up a bit, so I could find them again myself if for no other reason.

This is inspired in part by the blog rolls of the mid 2000s, in part by Brett Terpstra's web excursions, and in part by playing with Mastodon.

As you may have noticed from the contact links on this site I'm toying with moving from Twitter to Mastodon. More on that in another post no doubt, but this is all about being slightly more thoughtful about what I do online.

I can't tell whether the intentional misspelling of sightseeing is funny or not, but I think it works.

Previously

Earlier posts...