is OpenBSD 10x faster than Linux?


Here’s a little benchmark complements of Jann Horn. It’s unexpectedly slow on Linux.

OpenBSD is so fast, I had to modify the program slightly to measure itself, as the time utility is missing sufficient precision to even record nonzero.

All it does is create one extra thread, then both existing threads create 256 sockets. What’s so hard about that?

<span class=bi>#include <pthread.h></span>
<span class=bi>#include <unistd.h></span>
<span class=bi>#include <err.h></span>
<span class=bi>#include <stdio.h></span>
<span class=bi>#include <sys/time.h></span>
<span class=bi>#include <sys/socket.h></span>

<span class=tp>static</span> <span class=tp>void</span> open_sockets<span class=st>(</span><span class=tp>void</span><span class=st>)</span> <span class=st>{</span>
    <span class=kw>for</span> <span class=kw>(</span><span class=tp>int</span> i<span class=op>=</span><span class=nm>0</span>; i<span class=op><</span><span class=nm>256</span>; i<span class=op>++</span><span class=kw>)</span> <span class=kw>{</span>
        <span class=tp>int</span> sock <span class=op>=</span> socket<span class=cm>(</span>AF_INET<span class=op>,</span> SOCK_STREAM<span class=op>,</span> <span class=nm>0</span><span class=cm>)</span>;
        <span class=kw>if</span> <span class=cm>(</span>sock <span class=op>==</span> <span class=op>-</span><span class=nm>1</span><span class=cm>)</span>
            err<span class=cm>(</span><span class=nm>1</span><span class=op>,</span> <span class=st>"socket"</span><span class=cm>)</span>;
    <span class=kw>}</span>
<span class=st>}</span>

<span class=tp>static</span> <span class=tp>void</span> <span class=op>*</span>thread_fn<span class=st>(</span><span class=tp>void</span> <span class=op>*</span>dummy<span class=st>)</span> <span class=st>{</span>
    open_sockets<span class=kw>(</span><span class=kw>)</span>;
    <span class=kw>return</span> <span class=bi>NULL</span>;
<span class=st>}</span>

<span class=tp>int</span> main<span class=st>(</span><span class=tp>int</span> argc<span class=st>)</span> <span class=st>{</span>
    <span class=tp>struct</span> timeval one<span class=op>,</span> two;
    gettimeofday<span class=kw>(</span>&one<span class=op>,</span> <span class=bi>NULL</span><span class=kw>)</span>;
    <span class=kw>if</span> <span class=kw>(</span>argc <span class=op>></span> <span class=nm>1</span><span class=kw>)</span>
        dup2<span class=kw>(</span><span class=nm>0</span><span class=op>,</span> <span class=nm>666</span><span class=kw>)</span>;
    pthread_t thread;
    <span class=kw>if</span> <span class=kw>(</span>pthread_create<span class=cm>(</span>&thread<span class=op>,</span> <span class=bi>NULL</span><span class=op>,</span> thread_fn<span class=op>,</span> <span class=bi>NULL</span><span class=cm>)</span><span class=kw>)</span>
        errx<span class=kw>(</span><span class=nm>1</span><span class=op>,</span> <span class=st>"pthread_create"</span><span class=kw>)</span>;
    open_sockets<span class=kw>(</span><span class=kw>)</span>;
    <span class=kw>if</span> <span class=kw>(</span>pthread_join<span class=cm>(</span>thread<span class=op>,</span> <span class=bi>NULL</span><span class=cm>)</span><span class=kw>)</span>
        errx<span class=kw>(</span><span class=nm>1</span><span class=op>,</span> <span class=st>"pthread_join"</span><span class=kw>)</span>;
    gettimeofday<span class=kw>(</span>&two<span class=op>,</span> <span class=bi>NULL</span><span class=kw>)</span>;
    timersub<span class=kw>(</span>&two<span class=op>,</span> &one<span class=op>,</span> &one<span class=kw>)</span>;
    printf<span class=kw>(</span><span class=st>"elapsed: %lld.%06lds\n"</span><span class=op>,</span> one<span class=op>.</span>tv_sec<span class=op>,</span> one<span class=op>.</span>tv_usec<span class=kw>)</span>;
    <span class=kw>return</span> <span class=nm>0</span>;
<span class=st>}</span>

On Linux, I get results approximately as so:

tedu@penguin:~$ ./a.out 
elapsed: 0.017770s
tedu@penguin:~$ ./a.out 
elapsed: 0.026309s
tedu@penguin:~$ ./a.out 
elapsed: 0.018414s

On OpenBSD, here we go, choo choo:

ox$ ./a.out                                                                               
a.out: a.out: socketsocket: : Too many open files
Too many open files
ox$ ulimit -n 1024
ox$ ./a.out                                                                               
elapsed: 0.006096s
ox$ ./a.out  
elapsed: 0.002508s
ox$ ./a.out  
elapsed: 0.002326s

These aren’t identical machines, but roughly comparable.

There’s a hint in the code (nothing to do with networking code, if that was your first guess), with more explanation in the linked thread, which is worth reading and some thinking. I’d love to see the system and benchmark where Linux outperforms here.

Really, I just found it a little funny. Usually it’s the weirdo benchmark that shows OpenBSD being 10x slower, so this one is definitely going in the collection.

Belarus calls for food market stabilization mechanisms in EAEU eng.belta.by/economics/view/be…

Compiler Bug Causes Compiler Bug: How a 12-Year-Old G++ Bug Took Down Solidity

Link: osec.io/blog/2025-08-11-compil…
Discussion: news.ycombinator.com/item?id=4…

Sensitive content

This entry was edited (4 weeks ago)

It seems like the AI crawlers learned how to solve the Anubis challenges

Link: social.anoxinon.de/@Codeberg/1…
Discussion: news.ycombinator.com/item?id=4…


It seems like the AI crawlers learned how to solve the Anubis challenges. Anubis is a tool hosted on our infrastructure that requires browsers to do some heavy computation before accessing Codeberg again. It really saved us tons of nerves over the past months, because it saved us from manually maintaining blocklists to having a working detection for "real browsers" and "AI crawlers".

in reply to Chad Geidel

"AI software assistants make the hardest kinds of bugs to spot"

A geometry proof (for year 9 geometry) generated by AI is an nightmare to grade. When you find the error it's something a person capable of making the rest of the proof would never do.

I wonder how university mathematicians feel about AI written proof-shaped objects?

<s> Why hasn't anyone proved all the unsolved theorems with AI if it is so very smart? </s>

"A new, federated, independent, web is being born before our eyes, running on Activitypub (Mastodon) and Atproto (Bluesky). (...) If the people building this new web are wise, they will take irrevocable action that will limit their ability (and the ability of their successors) to fall prey to the siren song of enshittification in the future. This is called a "Ulysses pact" – when you tie yourself to the mast so that you don't yield to future temptation."

By @pluralistic

pluralistic.net/2025/08/15/dog…

Unknown parent

mastodon - Link to source

Cory Doctorow

@GroupNebula563
That's not what happened at all.

Masnick wrote "Protocols, Not Platforms."

Jack Dorsey liked it, largely because he was sick of being mired in content moderation debates, and he wanted to see if there was a way to separate como from posts for a future iteration of Twitter. He funded a skunkworks that later became a standalone entity.

Masnick's paper was 2017. Masto launched in 2018.

Unknown parent

mastodon - Link to source

Cory Doctorow

@GroupNebula563 You're right, but per WP:

> While Mastodon was first released in October 2016, the service began to expand in late March and early April 2017.

Citing to au.pcmag.com/social-media/4734…

cw quote boost, assassination of ceo

Sensitive content

ADHD drug treatment and risk of negative events and outcomes

Link: bmj.com/content/390/bmj-2024-0…
Discussion: news.ycombinator.com/item?id=4…

Dumb question that I was always too afraid to ask:

I know how the #Fediverse and its federation works. It's intuitive and familiar to me; I mean, I even host my own instance.

But I never understood how interaction cross-software is supposed to work. In theory, I can use whatever #ActivityPub software I want and still interact with everyone else. But in practice that just... isn't the case, right?

I mean, for text it's quite simple: I write a short post on #Mastodon and people on #GoToSocial or #Misskey or whatever can see and read that same post and interact with it. They can see my profile and it appears on their instance in their style and with their features.

Even outside of microblogging I still get it. A super-long post on #Friendica or #Diaspora appears on my timeline, too. Their profiles might have more fields than I can see here, but that's fine.

But what's up beyond that?

I can see #Pixelfed posts here, converted into image galleries. But what about the other way 'round? If someone on Pixelfed follows my Mastodon account, they can't see any of my non-image posts, right?

What about #PeerTube and such niche software? I guess I could follow a PeerTube account as a microblogger and see their videos and descriptions in my timeline. Video comments are replies.

But the other way 'round? How are they supposed to interact with Friendica or Pixelfed users? PeerTube doesn't even have a "timeline".

Doesn't that feature disparity undermine the whole idea of the #Fediverse or am I missing something?

#AskFedi #FediAdmin

in reply to lianna

I am asking this because I caught myself thinking about making a Mastodon account for my PeerTube space, in the same way you used to make a Twitter presence for your YouTube channel.

I realised that I should be able to just use my PeerTube account instead, since it's ActivityPub. That's the whole appeal of the Fediverse!

But since I can't write text posts, read timelines or interact in any way with non-video content on PeerTube, where is the point in federating with the rest of ActivityPub?

Is it only for commenters to be able to use their existing Fedi accounts to comment on PeerTube, and it's more of a one-way thing in reality?

#PeerTube #Fediverse #Fedi #AskFedi

in reply to lianna

under existing implementations, peertube instances interact with one another over activitypub, and peertube videos show up on timelines, replies become comments, etc.

In theory, peertube could implement timelines and text posts, but it seems unlikely that they will.

In practice, I have a non-peertube account for my peertube channels.

( @video and @newellijaytelevision )

PRAY. ✝️

I cannot overstate that.

theconservativetreehouse.com/b…

Rose reshared this.

What The Pacific Didn’t Show: Eugene Sledge’s Son on How ‘With the Old Breed’ Was Written

youtube.com/watch?v=ceGbkcE4xf…

"I was in the US Marines from 1961 until 1966, Vietnam Era. I read books about Marines before and after my service, but the ones I read beforehand are the ones that influenced me to join the Corps. My Pappy was a WWII ETO and Korea Army veteran, and he wanted me to join the Army. I think he was disappointed that I didn't, but later I think he was proud of me. After he & Mom died,

in reply to HunDriverWidow

I found a two boxes of letters in a basement closet. Mom had saved over 600 letters and documents that Pappy had sent to Mom from 1940 (before they were married) until 1951. He fought in the ETO as a combat engineer in the Ardennes and Remagen campaigns. I learned all this when I transcribed all the letters. It took me three years, including all the research I had to do, and I learned a great deal about my Pappy. It made me miss him all the more."

What’s your favorite naughty memory from college?

Easy, I had a threesome with two of my best “girl friends”. We were seniors and the three of us had been friends all 4 years, I was President of my Fraternity, and had a lot of clout in the school in my senior year. One Saturday afternoon we were all sitting in my room smoking a joint, and we just started talking about fantasies. I flat out told them both that one of my biggest ones was to sleep with them both. They just laughed and said “why not?” I thought they were kidding when one of them , Wendy came up to me and began kissing me, while Lisa took off her shirt and bra. I was flabbergasted to say the least, but within minutes we were all naked rolling around on my bed together. I was in heaven, Wendy sucked my cock while Lisa and I kissed and I played with her tits, then she sat on my face. I ate her pussy while I was getting a BJ from Wendy. Then Wendy sat on my cock and fucked me. Once I came, Lisa sucked my cock until I got hard again, then I fucked her, we remained in bed for what seemed like hours, actually it was most of the day, We fucked so many times I thought I didn’t have any cum left in my balls! It was the single best experience in college. We all still remain friends, but that one day was like something from a dream.

"It Was So Quiet" - What a MACV-SOG Operator Carries Everyday - Shawn Ryan Clips

youtube.com/watch?v=c1Ene64-DA…

Comment below the video:

"My Dad would call this guy a "Problem Solver". God Bless this Man. Thank you for your service sir."

"This is why I love you Shawn. My old man who I lost at 80 yrs. He was MSMC crack shot. He always loved the.22!!! The .22 was his bread and butter. He always told me and I'll never forget ".22 behind ...

in reply to HunDriverWidow

the ear". These old timers were a different breed."

"My grandaddy Bill was a river boat gunner in Vietnam. He ended up being on the first seal team before it was over. He was always kind to me and everyone I saw him interact with. On several occasions he woke up screaming from the nightmares. It's amazing how fortified he was to be that clearly damaged from what he experienced but still had the ability to be a good man. Men like this make me proud to be an American."

بررسی کتاب: «قهرمان» کرونشتات تاریخ مینویسد
libcom.org/article/brrsy-ktab-…