hjertnes.blog

Making Code Faster

19.06.2018 02:00

The basic idea behind optimising code is to make what it does today by doing “less”. When you do less, it takes shorter time. That doesn’t mean less code however.

  1. Figure out what takes the most time.
  2. Start at the top and find ways to make it go faster.
  3. Change one thing and test.
  4. Repeat.

Things like writing to disk, output (like printing) or committing write queries to databases are slow. When I write code I often first focus on getting it to work, and then I try to make it fast later. One of the first things I always do is to limit how often I commit transactions to the database. With complicated background jobs, you can take it from hours (with large data sets) to minutes if you limit how often you write to the database. By using transactions. The ideal is once.

Everything on GitHub

18.06.2018 02:00

If you are a software developer, you probably have a lot of code laying around. Because you needed something or wanted to learn something. But having something that you can use and having something other people can use are two different things. Because you have to make sure it is at least kind of easy to install it, run it, configure it etc.

One thing I have focused on doing since the start of 2017 is to put as much as possible on GitHub. I’ve had a rule: either I start making money on it, or it goes up on GitHub. If it is something I coded on my spare time.

There are many reasons for it, but the two most important ones are: if I put it up on GitHub, I make sure that it is easy “enough” to install and get started with it, that means that I don’t have to study the source code to figure out how it works between each time I use it. And it is awesome if someone else finds it either useful or can learn something from it.

Review: Kaweco Perkeo

18.06.2018 02:00

I got a Kaweco Perkeo from Tudos in the same package as I got the pencil stuff I purchased.

This is the first Kaweco pen I have used. And I really like it. The nib is very firm, with soft.

I’m not sure how I should describe the pen. Because it is basically a competitor to the Pilot Metropolitan or the Lamy Safari. But it is much lighter, and much more fun. It looks more like something a kid would use, than the boring design of the Metro. or Safari. It also comes with a moulded grip section, but it s not like the one of the Safari. It is much less prominent and I did not find it uncomfortable to use in any way.

One thing though. I keep unscrewing the pen instead of uncapping it. I’m not sure why. Probably because I’m so used to pens you have to unscrew when you uncap them.

I think this pen is better than both the Safari and the Metropolitan because the grip section should work for everyone, and it doesn’t have a uncomfortable edge like the Metropolitan does. And I think this will be my new recommendation as the first fountain pen.

#

16.06.2018 02:00

The keybase logo is too cute

#

15.06.2018 02:00

Seems like Spacemacs is much less of a dumpster fire since the last time I checked it out.

#

15.06.2018 02:00

I’d love it if micro.blog sent out some follow recommendation once a week, based on who those I follow follow that I don’t follow

Optimise for the problems you have.

15.06.2018 02:00

It is important to know what kind of problems you will get in the future. But remember: don’t spend a lot of time optimising for problems that you might get. But rather design your software in a way where it is as easy as possible to deal with those problems as you can see the signs of them becoming a problem.

Seeing how your users use your software is important to understand how you should optimise your database and code. For example, if you have a CMS with tags. There is no point in optimising it for a shit load of tags, if none of your users use more than five per post. Or have more than 50 different ones on their site.

#

14.06.2018 02:00

Not to confuse my earlier advice about meditation apps, I still consider Headspace to be the best place to start, but I have enjoyed the built in breathe app on the watch a lot lately.

#

14.06.2018 02:00

Edit for iOS is better than I hoped.

My custom Emacs.d

14.06.2018 02:00

I started to use Emacs with Spacemacs, and loved it, and then I moved over to Doom Emacs when it started to feel slow. And then I moved over to having my own thing when I realised that the kind of changes I wanted to make would be much easier if I went 100% custom. This is not the first time I tried this however. But nothing went anywhere the first time I tried it.

The reason I wanted to write my own was that I wanted to make sure my editor had less moving parts, and only had what I used. Instead of having a huge system for managing configuration and a lot of stuff I didn’t use. I’m very happy with it this far. It starts faster than Doom Emacs with a little, and faster than Spacemacs by a lot. And I can set stuff up in a way that makes the most sense for me.

The hardest thing about it was to identify the various packages or combination of packages that provide a certain functionality in Spacemacs and Doom. But everything worked like a charm after a few days.