Profiling Garbage Collection

Gene Goykhman over at Flaky Goodness has a nice hint on profiling garbage collection but the technique is more generally applicable. Goykhman wanted to know how much time he was spending in garbage collection while exporting his blog. It turns out there’s a really easy way to find that out.

The function benchmark-run will run its argument and report the total running time, the number of garbage collection calls, and the total time spent in garbage collection. That’s useful information to know for any function, even if all you’re interested in is the total running time.

Goykhman was concerned that garbage collection was taking up a significant amount of time in his export process so he arranged to inhibit it when he was exporting his blog. That worked out well for him but even if it’s not your problem, the benchmark-run function seems like a useful way of measuring the performance of your functions and perhaps adjusting things to improve performance.

Posted in General | Tagged | Leave a comment

Updating Builtin Packages

Charles Choi has a very informative post on the Emacs upgrading policy a very informative post on the Emacs upgrading policy. The TL;DR is that by default Emacs’ package.el will not upgrade packages that are builtin. Org is an example of this. The package is builtin but the Org team issues updates much more frequently than Emacs itself is upgraded. There’s a variable, package-install-upgrade-built-in, that can override this behavior and force package.el to upgrade packages whether or not they’re builtin.

When I read his post, I thought, “This is great. It’s the answer to why Org sometimes doesn’t upgrade correctly.” But then I realized that Org is upgraded by package.el even though package-install-upgrade-built-in is set to nil on my system.

So now I don’t know what’s going on. Org is certainly a builtin package but it doesn’t seem to be behaving in the manner described by Choi and the documentation. Choi’s use case involves transient, which he depends on for his Casual suite. He needed a later version but it was not upgraded for at least one of his users.

Perhaps the policy is restricted to the update of dependencies although the documentation does not reflect that. Fortunately, this is Emacs and all the source is available and hackable so it’s just a matter of digging into the code to see what’s going on. Perhaps I’ll do that in the near future but for now it’s enough to know that someone has thought about the issue and attempted a solution.

Updates
[2024-08-30 Fri 12:12]:

Philip Kaludercic explains what’s going on in this comment. What package-install-upgrade-built-in really does is interpret built-in as installed. Take a look at the comment for the full explanation.

[2024-09-02 Mon 18:16]:

Added link to Choi’s post.

Posted in General | Tagged | Leave a comment

Partying Like It’s The Last Century

It’s hard to be too cynical about the security practices of software vendors: even those selling “security” solutions. Although most Irreal readers probably know a lot more about good security practices than the average user, security is a difficult discipline requiring specialized knowledge.

That’s why, even we aware users, rely to the specialists. In practice, for most of us, that means we buy prebuilt solutions from companies with a good reputation. After all, security is their business so they’re mostly going to get things right.

Like most of you, I’m a developer and understand that there will always be bugs but we expect that the professionals will produce products that at least cover the basics. What, then, to make of the first article in this newsletter? Hardcoded credentials in a security product? You must be kidding.

Sadly, they aren’t kidding. This isn’t the first security screwup on the part of Solar Winds. You have to ask yourself why they have any customers left. This isn’t some esoteric hack that slipped in around otherwise sound protections. It’s hard coded credentials, which are probably the lowest of the low hanging fruit for cybercriminals.

Things like this are exactly why Bruce Schneier recommends using open source for your security products. You never know what’s hiding behind that closed source. Yes, as a practical matter most of us aren’t going to read that source but someone will and this sort of thing will get discovered sooner rather than later.

Of course, nothing will happen. Their customers will shrug and the most you can expect from Solar Winds is that some low level engineer will get fired as a sacrificial lamb. What should happen is that the CEO should fall on his sword and if he doesn’t, the board should show him the door. This kind of thing simply isn’t acceptable today. It hasn’t been acceptable for the last 30 years, at least.

Posted in General | Tagged | Leave a comment

Schneier On Staying Safe On The Internet

There may be more knowledgeable people on security than Bruce Schneier but hardly any of them are talking to us. They mostly work for the NSA or its brethren or they’re cybercriminals. Happily, Schneier does talk to us and he has good new and bad news.

The bad news is that if the NSA wants to be on your computer, they’re going to be on your computer. They simply have too many resources for just about anyone—and certainly for the average user—to resist. The good news is that they probably won’t try to get on your computer. It’s hard and risky for them to target individual computers so they do it only for high value targets. Unless you’re an Osama bin Laden lieutenant, you probably don’t need to worry.

That doesn’t mean the NSA isn’t reading everything you write though. What they do do is vacuum up essentially every bit of Internet traffic on the net. They do this through a variety of means that Schneier discusses in his post. It starts with secret agreements with the Internet infrastructure providers that allows them to tap into all the net traffic.

But it doesn’t stop there. They also do everything they can to weaken encryption standards. Usually this involves something esoteric like weakening the random number generator that can be dismissed as an error if it’s discovered. The TL;DR is that it’s really hard to protect yourself.

Still, Schneier has some recommendations. They involve using strong encryption—preferably open source implementations—to protect your data. It’s probably true that if the NSA really, really wants to read your data, they will but it pays to make it as difficult as possible so they won’t bother unless you’re the aforementioned bin Laden lieutenant.

Take a look at his post for some actionable advice if you want to protect your data.

Posted in General | Tagged | Leave a comment

Ten Coding Fonts

A perennial topic of interest to programmers is their coding font. I’ve been using Inconsolata for as long as I can remember. I adopted it when I was still a Vim user and carried it over to Emacs. In my more than 17 years with Emacs, I’ve never used anything else.

Shockingly, to me at least, I started using Inconsolata before some Irreal readers were born. Still, every time I see an article about someone’s favorite coding font(s) I invariably have to look. As I’ve said before, my main requirement for a font is that I can discern the difference between 0, O, o, i, I, l, L, and 1. It’s surprising how many fonts get this wrong.

Jordi Ollé Ballesté has some excellent font porn in a post that lists his 10 favorite fonts. Some are paid and some, like inconsolata, are free. As usual, I didn’t see anything that made me want to move from Inconsolata but your mileage may vary.

It is, in any event, worth taking a look. Maybe you’ll find a new font but even if you don’t you’ll probably enjoy looking at the possibilities. As Ballesté says, your choice of font can make a big difference in your coding experience. Articles like Ballesté’s show you the possibilities.

Posted in General | Tagged , | Leave a comment

Nothing Today Because I’m Exhausted

Yesterday was a lost day. I haven’t been happy with my WiFi router so I got a new one and yesterday was the day that I was going to spend an hour or so installing it and updating my network. Installing the router and updating computers, phones, and tablets] wasn’t too much trouble although the router app was less than clear on a couple of issues. All that did indeed take less than an hour.

Then came the hard part. The Irreal bunker runs on Apple Home Kit and has several smart light switches, a TV, and a security camera all running on the network. I was hoping that once I updated the hub (aka the Apple TV) everything else would fall into place. Yeah right. Nothing worked and it took me all day to figure out what to do.

In the end, I had to delete each device and readd it. But that means I had to figure out how to get the device to go through pairing procedure again. It was, to say the least, not easy. The smart switches were particularly opaque but I finally figure out the spell.

That left the camera. You’re supposed to be able to stick a paper clip in the reset hole and do a network reset that allows it connect to the new network. As if. After some more research, I discovered that you could do a complete reset by holding the paper clip in for more than 10 seconds. After I did that, the camera connected to the new network and all is well.

I’m sure there’s an easier way to do these things but I couldn’t discover them. It should be a bit easier because, after all, changing your router isn’t all that unusual. Maybe it is, but I couldn’t find the spell. In any event, the Irreal bunker is back on line and assiduously pursuing our goal of world domination.

Posted in General | Tagged | Leave a comment

Why Isn’t Lisp Used More In Production Redux

I just came across an excellent Medium article by Kenichi Sasagawa that addresses the question of Why Isn’t Lisp Used More In Production that I wrote about the other day. My post took the somewhat cynical view that Lisp lost the language wars for the same reasons that Betamax lost out to the technically inferior VHS.

Sasagawa has a different view. He considers Lisp an “intellectual toy” in the good sense of bringing joy and fun to its users. Languages like Python, he says, bring to mind drudgery more than fun. Still, Python is very popular because it makes it easy to generate a lot of code easily. The batteries, as they say, are included.

I agree with Sasagawa completely about how much fun it is to use Lisp and I agree that it brings me a joy and pleasure that other languages don’t. What I don’t agree with is his implication that these other languages are more efficient than Lisp in the sense that it’s easier to generate code. My experience has been just the opposite: it’s easier for me to generate code with Lisp than it is with other languages.

Sasagawa’s article also speaks to another of my recent posts, Marlinspike On What’s Wrong With Software Development. Marlinspike claims that current development processes—largely imposed from above—have robbed all the joy from software development.

If you care about Lisp and software development, take a look at Sasagawa’s article. It’s short and a very interesting read.

Posted in General | Tagged | Leave a comment

🥩 Red Meat Friday: Toilet paper

Toilet paper? Wha? Most of us can go our entire lives—modulo COVID induced shortages—without ever thinking about it. You buy it, you use it, you buy some more. But COVID did make us think about this everyday item and wonder why something like COVID, that didn’t seem to have any direct connection with toilet paper and its production, would so dramatically affect its supply.

Once you start asking questions and looking into things, the next thing you notice is that the sheet count of rolls keep shrinking. It’s really hard to track this because the rolls are described with terms like “super duper mega size” rather than an actual sheet count.

Mark Dent has looked into it and has tried to make sense of how much toilet paper we’re really getting. The news isn’t good. He shows that, in fact, the sheet count has been shrinking for years—long before COVID. For example, in 1966 a roll of Charmin had 650 sheets. Today it has 224. The price per square foot has increased 800%.

It’s practically impossible for the average buyer to track this because comparisons are to products that are no longer available. Not all of this can be laid to price gouging. The wood pulp market that the manufacturers depend on is notoriously volatile and industry practices make it hard to nail down a stable price.

The manufacturers, rather than simply increasing the price per roll when necessary have resorted to stealth increases by decreasing the amount of product while keeping the price constant or increasing it only slightly.

After COVID, most of us are just happy to have a reliable supply and don’t think too much about the cost. Of course many people don’t have the luxury of being blasé about the price. They need roughly the same amount as the rest of us so this stealth inflation is a real issue for them.

For years, the government has been making noises about fixing this but, of course, things are the same. Take a look at Dent’s article. It’s enlightening.

Posted in General | Tagged | Leave a comment

On Sharing The Benefits Of Emacs

Most experienced Emacsers recognize the futility of proselytizing for our favorite editor. Basically, no one but the already convinced want to hear about it. They’re sure the bling, menus, and mouse actions offered by those other editors are superior to an editor that’s older than most of them. But they lack something we have: experience with both their chosen editor and Emacs.

My own proselytizing is mostly confined to Irreal. I very rarely try to convince people one-on-one anymore. Of course, Irreal readers are mostly Emacs users so I’m largely preaching to the choir. Still, we do what we can do.

Gene Goykhman over at Flaky Goodness has a similar story. One thing I liked about his post is that he quotes Prot on the compounding benefits of learning Emacs. Yes, there is a learning curve and it’s (relatively) difficult for beginners to get going but before too long the compounding sets in and, as Prot says, we start to get more out of studying Emacs than we put in.

Of course, we can’t tell anyone this because they don’t want to hear it.

Posted in General | Tagged | Leave a comment

What Is Emacs and Why Should You Use It

Explaining Emacs to non-users is challenging. A first order explanation is that it’s a text editor but as we all know that’s a pitifully inadequate explanation. As you’re all aware, my default explanation is that it’s a light-weight Lisp Machine but that’s probably not very useful to anyone who doesn’t already know the answer.

Over at The Art Of Not Asking Why JTR attempts to give a simpler answer to the question. For him, as for most of us, the defining characteristic is Emacs’ configurability. JTR uses the metaphor of a coffee maker that not only brews your coffee but makes toast just the way you like it, orders coffee from your favorite roaster, and loads a crossword puzzle tailored specifically for you onto your smartphone. That’s Emacs. It does just what you want in just the way you want to do it.

With Emacs, your code becomes part of Emacs, virtually indistinguishable from the code that comes with the distribution. That means you have almost complete control over what Emacs does and how it does it. It’s hard to think of any other piece of software for which that’s true.

We all have our Emacs story and why we love it and JTR’s is a nice example of the genre. Probably no one but JTR will be completely satisfied with his story because, as I say, we all have our own.

Posted in General | Tagged | Leave a comment