Are you over 18 and want to see adult content?
More Annotations
A complete backup of www.business-standard.com/article/jobs/rsmssb-recruitment-2020-notification-apply-for-1054-junior-engineer-
Are you over 18 and want to see adult content?
A complete backup of corrieredellumbria.corr.it/news/economia/1459771/bonus-facciate-elenco-interventi-detrazione-90-per-cento-l
Are you over 18 and want to see adult content?
A complete backup of www.elespectador.com/deportes/futbol-internacional/manchester-city-no-podra-jugar-competiciones-europeas-du
Are you over 18 and want to see adult content?
A complete backup of www.filmibeat.com/telugu/news/2020/world-famous-lover-twitter-review-here-s-what-audiences-feel-about-the-v
Are you over 18 and want to see adult content?
Favourite Annotations
A complete backup of newtalk.tw/news/view/2020-02-08/364093
Are you over 18 and want to see adult content?
A complete backup of www.wa.de/sport/fussball/werder-bremen-union-berlin-live-ticker-bundesliga-21-spieltag-aufstellung-startelf
Are you over 18 and want to see adult content?
A complete backup of www.haaretz.co.il/gallery/cinema/oscar/1.8510598
Are you over 18 and want to see adult content?
A complete backup of www.news.ro/sport/juventus-torino-esec-cu-hellas-verona-in-serie-a-scor-1-2-desi-a-condus-cu-1-0-1922404308
Are you over 18 and want to see adult content?
A complete backup of www.centrometeoitaliano.it/notizie-meteo/meteo-milano-sole-e-temperature-in-aumento-nei-prossimi-giorni-ecc
Are you over 18 and want to see adult content?
Text
PROBABLY DANCE
The heap is a data structure that I use all the time and that others somehow use rarely. (I once had a coworker tell me that he knew some code was mine because it used a heap) Recently I was writing code that could really benefit from using a heap (as most code can) but I needed to be able to pop items from both ends. THE PROBLEMS WITH UNIFORM INITIALIZATION C++11 made the {} syntax for initializing aggregates more widely usable. You can now also use it to call constructors and to initialize with a std::initializer_list. It also allows you to drop the type name in some circumstances. The general recommendation seems to be that you use it as much as possible. But when I A FASTER IMPLEMENTATION OF STD::FUNCTION As I wrote in my last post, I consider std::function to be a very important class that will change how you design your code, because it means that you have to use inheritance less often.In that post I was very impressed with the performance of std::function when compiled with optimizations. Unfortunately std::function can be far slower than a virtual function call in debug. JANUARY | 2021 | PROBABLY DANCE 1 post published by Malte Skarupke during January 2021. The CDC continues to issue very puzzling guidelines about the coronavirus. IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE I replayed Warcraft III recently and was looking for other games I could play in the same genre. Turns out that outside of StarCraft 2, there are no recent games that are anywhere near as good. What happened? This blog post was actually prompted by me watching a recommended video on Youtube about exactly this I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing FUNCTIONAL PROGRAMMING IS NOT POPULAR BECAUSE IT IS WEIRD I've seen people be genuinely puzzled about why functional programming is not more popular. For example I'm currently reading "Out of the Tar Pit" where after arguing for functional programming the authors say Still, the fact remains that such arguments have been insufficient to result in widespread adoption of functional programming. We musttherefore conclude
PROBABLY DANCE
The heap is a data structure that I use all the time and that others somehow use rarely. (I once had a coworker tell me that he knew some code was mine because it used a heap) Recently I was writing code that could really benefit from using a heap (as most code can) but I needed to be able to pop items from both ends. THE PROBLEMS WITH UNIFORM INITIALIZATION C++11 made the {} syntax for initializing aggregates more widely usable. You can now also use it to call constructors and to initialize with a std::initializer_list. It also allows you to drop the type name in some circumstances. The general recommendation seems to be that you use it as much as possible. But when I A FASTER IMPLEMENTATION OF STD::FUNCTION As I wrote in my last post, I consider std::function to be a very important class that will change how you design your code, because it means that you have to use inheritance less often.In that post I was very impressed with the performance of std::function when compiled with optimizations. Unfortunately std::function can be far slower than a virtual function call in debug. JANUARY | 2021 | PROBABLY DANCE 1 post published by Malte Skarupke during January 2021. The CDC continues to issue very puzzling guidelines about the coronavirus. IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE I replayed Warcraft III recently and was looking for other games I could play in the same genre. Turns out that outside of StarCraft 2, there are no recent games that are anywhere near as good. What happened? This blog post was actually prompted by me watching a recommended video on Youtube about exactly this I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing FUNCTIONAL PROGRAMMING IS NOT POPULAR BECAUSE IT IS WEIRD I've seen people be genuinely puzzled about why functional programming is not more popular. For example I'm currently reading "Out of the Tar Pit" where after arguing for functional programming the authors say Still, the fact remains that such arguments have been insufficient to result in widespread adoption of functional programming. We musttherefore conclude
JANUARY | 2021 | PROBABLY DANCE 1 post published by Malte Skarupke during January 2021. The CDC continues to issue very puzzling guidelines about the coronavirus. MARCH | 2020 | PROBABLY DANCE 1 post published by Malte Skarupke during March 2020. I’ve had an obsession recently with a mod for Warcraft 3. It’s called Survival Chaos.I want to talk about it because it’s part of a genre of strategy games that hasn’t had a big success yet, and this feels like a big evolution, maybe even a breakthrough. OCTOBER | 2020 | PROBABLY DANCE 1 post published by Malte Skarupke during October 2020. TLA+ is a formal specification language that you can use to verify programs. NOVEMBER | 2020 | PROBABLY DANCE 1 post published by Malte Skarupke during November 2020. The 2020 US election is finally over, and all the election excitement of the last week reminded me of something I had been meaning to look into: Sergey Shpilkin’s data visualizations that clearly show fraud in Russianelections.
MAY | 2020 | PROBABLY DANCE 1 post published by Malte Skarupke during May 2020. Currently much of the country is shut down to stop the spread of the coronavirus and there is very active debate about how soon we should open up again. APRIL | 2020 | PROBABLY DANCE 1 post published by Malte Skarupke during April 2020. You have to write these things down while you still remember them. I was already beginning to forget that there was a toilet paper shortage. UNDERSTANDING WHY THE CDC GIVES THE GUIDELINES THAT IT The CDC continues to issue very puzzling guidelines about the coronavirus. The most recent strange recommendation is that even if you already had covid, you should still get the vaccine. Which makes no sense? Let's assume our goal is to reduce the number of deaths. Currently in the US, something like 26 million people have FINDING FLOATING POINT NUMBERS FOR EXACT MATH For the second time in my career, I ran into a problem where it's actually useful to know how floating point numbers work. (first time was here) The problem is that sometimes you want floating point numbers that add well. So that you have the associativity guarantee that (a + b) + c == a HANDMADE COROUTINES FOR WINDOWS In a previous post I implemented coroutines using the ucontext.h header. In this post I will show a replacement that should be much faster. I will also provide a Windows implementation. I like to start off with some code, so here is the complete code for switching the stack in Linux: All code in this C++11 COMPLETED RAII, MAKING COMPOSITION EASIER The addition of move semantics in C++11 is not just a performance and safety improvement. It's also the feature that completed RAII. And as of C++11 I believe that RAII is absolutely necessary to make object composition easy in the language. To illustrate let's look at how objects were composed before C++11, what problems wePROBABLY DANCE
The heap is a data structure that I use all the time and that others somehow use rarely. (I once had a coworker tell me that he knew some code was mine because it used a heap) Recently I was writing code that could really benefit from using a heap (as most code can) but I needed to be able to pop items from both ends. JANUARY | 2021 | PROBABLY DANCE 1 post published by Malte Skarupke during January 2021. The CDC continues to issue very puzzling guidelines about the coronavirus. WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE I replayed Warcraft III recently and was looking for other games I could play in the same genre. Turns out that outside of StarCraft 2, there are no recent games that are anywhere near as good. What happened? This blog post was actually prompted by me watching a recommended video on Youtube about exactly this THE PROBLEMS WITH UNIFORM INITIALIZATION C++11 made the {} syntax for initializing aggregates more widely usable. You can now also use it to call constructors and to initialize with a std::initializer_list. It also allows you to drop the type name in some circumstances. The general recommendation seems to be that you use it as much as possible. But when I A FASTER IMPLEMENTATION OF STD::FUNCTION As I wrote in my last post, I consider std::function to be a very important class that will change how you design your code, because it means that you have to use inheritance less often.In that post I was very impressed with the performance of std::function when compiled with optimizations. Unfortunately std::function can be far slower than a virtual function call in debug. MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since WHY VIDEO GAME AI DOES NOT USE MACHINE LEARNING I used to be an AI programmer working on video games, and I'm currently trying to learn machine learning. As part of this I find myself having to repeatedly explain why video games don't use machine learning. People seem to find it interesting enough because it's not just the obvious reasons (machine learning is hard I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction inPROBABLY DANCE
The heap is a data structure that I use all the time and that others somehow use rarely. (I once had a coworker tell me that he knew some code was mine because it used a heap) Recently I was writing code that could really benefit from using a heap (as most code can) but I needed to be able to pop items from both ends. JANUARY | 2021 | PROBABLY DANCE 1 post published by Malte Skarupke during January 2021. The CDC continues to issue very puzzling guidelines about the coronavirus. WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE I replayed Warcraft III recently and was looking for other games I could play in the same genre. Turns out that outside of StarCraft 2, there are no recent games that are anywhere near as good. What happened? This blog post was actually prompted by me watching a recommended video on Youtube about exactly this THE PROBLEMS WITH UNIFORM INITIALIZATION C++11 made the {} syntax for initializing aggregates more widely usable. You can now also use it to call constructors and to initialize with a std::initializer_list. It also allows you to drop the type name in some circumstances. The general recommendation seems to be that you use it as much as possible. But when I A FASTER IMPLEMENTATION OF STD::FUNCTION As I wrote in my last post, I consider std::function to be a very important class that will change how you design your code, because it means that you have to use inheritance less often.In that post I was very impressed with the performance of std::function when compiled with optimizations. Unfortunately std::function can be far slower than a virtual function call in debug. MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since WHY VIDEO GAME AI DOES NOT USE MACHINE LEARNING I used to be an AI programmer working on video games, and I'm currently trying to learn machine learning. As part of this I find myself having to repeatedly explain why video games don't use machine learning. People seem to find it interesting enough because it's not just the obvious reasons (machine learning is hard I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in JANUARY | 2021 | PROBABLY DANCE 1 post published by Malte Skarupke during January 2021. The CDC continues to issue very puzzling guidelines about the coronavirus. MAY | 2020 | PROBABLY DANCE 1 post published by Malte Skarupke during May 2020. Currently much of the country is shut down to stop the spread of the coronavirus and there is very active debate about how soon we should open up again. NOVEMBER | 2020 | PROBABLY DANCE 1 post published by Malte Skarupke during November 2020. The 2020 US election is finally over, and all the election excitement of the last week reminded me of something I had been meaning to look into: Sergey Shpilkin’s data visualizations that clearly show fraud in Russianelections.
JULY | 2020 | PROBABLY DANCE 1 post published by Malte Skarupke during July 2020. Programmers have a habit of over-generalizing things, and so it happened that I found myself writing more generalized versions of rotation, translation and scaling, the three most common operations that you’d want to do to3D objects.
APRIL | 2020 | PROBABLY DANCE 1 post published by Malte Skarupke during April 2020. You have to write these things down while you still remember them. I was already beginning to forget that there was a toilet paper shortage. MARCH | 2020 | PROBABLY DANCE 1 post published by Malte Skarupke during March 2020. I’ve had an obsession recently with a mod for Warcraft 3. It’s called Survival Chaos.I want to talk about it because it’s part of a genre of strategy games that hasn’t had a big success yet, and this feels like a big evolution, maybe even a breakthrough. UNDERSTANDING WHY THE CDC GIVES THE GUIDELINES THAT IT The CDC continues to issue very puzzling guidelines about the coronavirus. The most recent strange recommendation is that even if you already had covid, you should still get the vaccine. Which makes no sense? Let's assume our goal is to reduce the number of deaths. Currently in the US, something like 26 million people have FINDING FLOATING POINT NUMBERS FOR EXACT MATH For the second time in my career, I ran into a problem where it's actually useful to know how floating point numbers work. (first time was here) The problem is that sometimes you want floating point numbers that add well. So that you have the associativity guarantee that (a + b) + c == a HANDMADE COROUTINES FOR WINDOWS In a previous post I implemented coroutines using the ucontext.h header. In this post I will show a replacement that should be much faster. I will also provide a Windows implementation. I like to start off with some code, so here is the complete code for switching the stack in Linux: All code in this FUNCTIONAL PROGRAMMING IS NOT POPULAR BECAUSE IT IS WEIRD I've seen people be genuinely puzzled about why functional programming is not more popular. For example I'm currently reading "Out of the Tar Pit" where after arguing for functional programming the authors say Still, the fact remains that such arguments have been insufficient to result in widespread adoption of functional programming. We musttherefore conclude
PROBABLY DANCE
The heap is a data structure that I use all the time and that others somehow use rarely. (I once had a coworker tell me that he knew some code was mine because it used a heap) Recently I was writing code that could really benefit from using a heap (as most code can) but I needed to be able to pop items from both ends. MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing A FASTER IMPLEMENTATION OF STD::FUNCTION As I wrote in my last post, I consider std::function to be a very important class that will change how you design your code, because it means that you have to use inheritance less often.In that post I was very impressed with the performance of std::function when compiled with optimizations. Unfortunately std::function can be far slower than a virtual function call in debug. IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could FIBONACCI HASHING: THE OPTIMIZATION THAT THE WORLD FORGOTSEE MORE ONPROBABLYDANCE.COM
I WROTE A FASTER SORTING ALGORITHM FUNCTIONAL PROGRAMMING IS NOT POPULAR BECAUSE IT IS WEIRD I've seen people be genuinely puzzled about why functional programming is not more popular. For example I'm currently reading "Out of the Tar Pit" where after arguing for functional programming the authors say Still, the fact remains that such arguments have been insufficient to result in widespread adoption of functional programming. We musttherefore conclude
ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in A NEW FAST HASH TABLE IN RESPONSE TO GOOGLE’S NEW FAST Hi, I wrote my new favorite hash table. This came about because last year I wrote the fastest hash table (I still make that claim) and this year one of the organizers of the C++Now conference asked me to give a talk. My problem was that Google had also announced a new fast hash table last year, and I wasn’t sure if mine would compare wellagainst theirs.
PROBABLY DANCE
The heap is a data structure that I use all the time and that others somehow use rarely. (I once had a coworker tell me that he knew some code was mine because it used a heap) Recently I was writing code that could really benefit from using a heap (as most code can) but I needed to be able to pop items from both ends. MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing A FASTER IMPLEMENTATION OF STD::FUNCTION As I wrote in my last post, I consider std::function to be a very important class that will change how you design your code, because it means that you have to use inheritance less often.In that post I was very impressed with the performance of std::function when compiled with optimizations. Unfortunately std::function can be far slower than a virtual function call in debug. IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could FIBONACCI HASHING: THE OPTIMIZATION THAT THE WORLD FORGOTSEE MORE ONPROBABLYDANCE.COM
I WROTE A FASTER SORTING ALGORITHM FUNCTIONAL PROGRAMMING IS NOT POPULAR BECAUSE IT IS WEIRD I've seen people be genuinely puzzled about why functional programming is not more popular. For example I'm currently reading "Out of the Tar Pit" where after arguing for functional programming the authors say Still, the fact remains that such arguments have been insufficient to result in widespread adoption of functional programming. We musttherefore conclude
ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in A NEW FAST HASH TABLE IN RESPONSE TO GOOGLE’S NEW FAST Hi, I wrote my new favorite hash table. This came about because last year I wrote the fastest hash table (I still make that claim) and this year one of the organizers of the C++Now conference asked me to give a talk. My problem was that Google had also announced a new fast hash table last year, and I wasn’t sure if mine would compare wellagainst theirs.
JANUARY | 2021 | PROBABLY DANCE 1 post published by Malte Skarupke during January 2021. The CDC continues to issue very puzzling guidelines about the coronavirus. WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE I replayed Warcraft III recently and was looking for other games I could play in the same genre. Turns out that outside of StarCraft 2, there are no recent games that are anywhere near as good. What happened? This blog post was actually prompted by me watching a recommended video on Youtube about exactly this LESS WEIRD QUATERNIONS I've always been frustrated by how mysterious quaternions are. They arise from weird equations that you just have to memorize, and are difficult to debug because as soon as you deviate too far from the identity quaternion, the numbers are really hard to interpret. Most people implement quaternions once and then treat them as a USING TLA+ IN THE REAL WORLD TO UNDERSTAND A GLIBC BUG TLA+ is a formal specification language that you can use to verify programs. It's different from other formal verification systems in that it's very pragmatic. Instead of writing proofs, it works using the simple method of running all possible executions of a program. You can write assertions and if they're not true for any possiblePARTIAL SCALING
Programmers have a habit of over-generalizing things, and so it happened that I found myself writing more generalized versions of rotation, translation and scaling, the three most common operations that you'd want to do to 3D objects. These were more generalized in that they had a parameter for how much you want to do a ON MODERN HARDWARE THE MIN-MAX HEAP BEATS A BINARY HEAP The heap is a data structure that I use all the time and that others somehow use rarely. (I once had a coworker tell me that he knew some code was mine because it used a heap) Recently I was writing code that could really benefit from using a heap (as most code can) but I needed to be able to pop items from both ends. FINDING FLOATING POINT NUMBERS FOR EXACT MATH For the second time in my career, I ran into a problem where it's actually useful to know how floating point numbers work. (first time was here) The problem is that sometimes you want floating point numbers that add well. So that you have the associativity guarantee that (a + b) + c == a ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in WHY VIDEO GAME AI DOES NOT USE MACHINE LEARNING I used to be an AI programmer working on video games, and I'm currently trying to learn machine learning. As part of this I find myself having to repeatedly explain why video games don't use machine learning. People seem to find it interesting enough because it's not just the obvious reasons (machine learning is hard ON A FUTURE OF SCREEN-LESS COMPUTERS The current problem with computers was well articulated in the piece The Machine Stops by the late Oliver Sacks: I cannot get used to seeing myriads of people in the street peering into little boxes or holding them in front of their faces, walking blithely in the path of moving traffic, totally out of touchPROBABLY DANCE
Using TLA+ in the Real World to Understand a Glibc Bug. TLA+ is a formal specification language that you can use to verify programs. It’s different from other formal verification systems in that it’s very pragmatic. Instead of writing proofs, it works using the simple method of running all possible executions of a program. MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing A FASTER IMPLEMENTATION OF STD::FUNCTION My implementation beats std::function in all categories, and it beats a virtual function call in optimized builds. In debug builds it is roughly 50% slower than a virtual function call. Which is not ideal, but it is better than other implementations. I think I can live with this. The benefits of std::function still far outweigh the downsides I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since FIBONACCI HASHING: THE OPTIMIZATION THAT THE WORLD FORGOTSEE MORE ONPROBABLYDANCE.COM
I WROTE A FASTER SORTING ALGORITHM FUNCTIONAL PROGRAMMING IS NOT POPULAR BECAUSE IT IS WEIRD Functional programming is just a bit too weird. To talk about functional programming let’s bake a cake. Taking a recipe from here, this is how you bake an imperative cake: Preheat oven to 175 degrees C. Grease and flour 2 – 8 inch round pans. In a small ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in A NEW FAST HASH TABLE IN RESPONSE TO GOOGLE’S NEW FAST Hi, I wrote my new favorite hash table. This came about because last year I wrote the fastest hash table (I still make that claim) and this year one of the organizers of the C++Now conference asked me to give a talk. My problem was that Google had also announced a new fast hash table last year, and I wasn’t sure if mine would compare wellagainst theirs.
PROBABLY DANCE
Using TLA+ in the Real World to Understand a Glibc Bug. TLA+ is a formal specification language that you can use to verify programs. It’s different from other formal verification systems in that it’s very pragmatic. Instead of writing proofs, it works using the simple method of running all possible executions of a program. MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing A FASTER IMPLEMENTATION OF STD::FUNCTION My implementation beats std::function in all categories, and it beats a virtual function call in optimized builds. In debug builds it is roughly 50% slower than a virtual function call. Which is not ideal, but it is better than other implementations. I think I can live with this. The benefits of std::function still far outweigh the downsides I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since FIBONACCI HASHING: THE OPTIMIZATION THAT THE WORLD FORGOTSEE MORE ONPROBABLYDANCE.COM
I WROTE A FASTER SORTING ALGORITHM FUNCTIONAL PROGRAMMING IS NOT POPULAR BECAUSE IT IS WEIRD Functional programming is just a bit too weird. To talk about functional programming let’s bake a cake. Taking a recipe from here, this is how you bake an imperative cake: Preheat oven to 175 degrees C. Grease and flour 2 – 8 inch round pans. In a small ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in A NEW FAST HASH TABLE IN RESPONSE TO GOOGLE’S NEW FAST Hi, I wrote my new favorite hash table. This came about because last year I wrote the fastest hash table (I still make that claim) and this year one of the organizers of the C++Now conference asked me to give a talk. My problem was that Google had also announced a new fast hash table last year, and I wasn’t sure if mine would compare wellagainst theirs.
JANUARY | 2021 | PROBABLY DANCE Currently in the US, something like 26 million people have tested positive for SARS-CoV2, and roughly 440,000 people have died of COVID19. I’m using these terms to make a distinction: Not everyone who gets the virus will get sick, and not everyone who gets sick will die. Let’s be generous and assume that 100 million people got thevirus so
WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE The main point of this is to prove the point that the RTS genre really did splinter into many different directions and subgenres: Ensemble Studios made Halo Wars for consoles and then died. There was also a free-to-play version of Age of Empires made by Gas Powered Games. Some ex-Ensemble people founded Robot Entertainment.PARTIAL SCALING
Programmers have a habit of over-generalizing things, and so it happened that I found myself writing more generalized versions of rotation, translation and scaling, the three most common operations that you'd want to do to 3D objects. These were more generalized in that they had a parameter for how much you want to do a USING TLA+ IN THE REAL WORLD TO UNDERSTAND A GLIBC BUG TLA+ is a formal specification language that you can use to verify programs. It's different from other formal verification systems in that it's very pragmatic. Instead of writing proofs, it works using the simple method of running all possible executions of a program. You can write assertions and if they're not true for any possible ON MODERN HARDWARE THE MIN-MAX HEAP BEATS A BINARY HEAP Meaning if if this was the only number that counted, a min-max heap of size 1,000,000 would be as fast as a binary heap of size 1,000. In practice the benefit isn’t that big because we have to do more work for the min-max heap. Here is the time to push an item: And here is the time to pop an item: FINDING FLOATING POINT NUMBERS FOR EXACT MATH Let’s say we pick a cost of 1 to go north, east, west or south, and we pick a cost of 1.41 to go diagonally. (the real cost is sqrt (2), but 1.41 should be close enough) Then the first path adds up to 1.41 + 1.41 + 1 = 3.82, and the second path adds up to 1 + 1.41 + 1.41 = 3.82. Except since these are floating point numbers, they don’t add LESS WEIRD QUATERNIONS I've always been frustrated by how mysterious quaternions are. They arise from weird equations that you just have to memorize, and are difficult to debug because as soon as you deviate too far from the identity quaternion, the numbers are really hard to interpret. Most people implement quaternions once and then treat them as a WHY VIDEO GAME AI DOES NOT USE MACHINE LEARNING The classical algorithm then trusts the machine learning part and only looks at the “important” moves when trying to determine which move is best. Anyway with the introductions out of the way, here are the main reasons why video game AI does not use machine learning: 1. Machine Learning is Hard and Far From Solved for Game Playing. ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in ON A FUTURE OF SCREEN-LESS COMPUTERS The current problem with computers was well articulated in the piece The Machine Stops by the late Oliver Sacks: I cannot get used to seeing myriads of people in the street peering into little boxes or holding them in front of their faces, walking blithely in the path of moving traffic, totally out of touchPROBABLY DANCE
Using TLA+ in the Real World to Understand a Glibc Bug. TLA+ is a formal specification language that you can use to verify programs. It’s different from other formal verification systems in that it’s very pragmatic. Instead of writing proofs, it works using the simple method of running all possible executions of a program. JANUARY | 2021 | PROBABLY DANCE Currently in the US, something like 26 million people have tested positive for SARS-CoV2, and roughly 440,000 people have died of COVID19. I’m using these terms to make a distinction: Not everyone who gets the virus will get sick, and not everyone who gets sick will die. Let’s be generous and assume that 100 million people got thevirus so
WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE The main point of this is to prove the point that the RTS genre really did splinter into many different directions and subgenres: Ensemble Studios made Halo Wars for consoles and then died. There was also a free-to-play version of Age of Empires made by Gas Powered Games. Some ex-Ensemble people founded Robot Entertainment. MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since A FASTER IMPLEMENTATION OF STD::FUNCTION My implementation beats std::function in all categories, and it beats a virtual function call in optimized builds. In debug builds it is roughly 50% slower than a virtual function call. Which is not ideal, but it is better than other implementations. I think I can live with this. The benefits of std::function still far outweigh the downsides ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could WHY VIDEO GAME AI DOES NOT USE MACHINE LEARNING The classical algorithm then trusts the machine learning part and only looks at the “important” moves when trying to determine which move is best. Anyway with the introductions out of the way, here are the main reasons why video game AI does not use machine learning: 1. Machine Learning is Hard and Far From Solved for Game Playing. A NEW FAST HASH TABLE IN RESPONSE TO GOOGLE’S NEW FAST Hi, I wrote my new favorite hash table. This came about because last year I wrote the fastest hash table (I still make that claim) and this year one of the organizers of the C++Now conference asked me to give a talk. My problem was that Google had also announced a new fast hash table last year, and I wasn’t sure if mine would compare wellagainst theirs.
PROBABLY DANCE
Using TLA+ in the Real World to Understand a Glibc Bug. TLA+ is a formal specification language that you can use to verify programs. It’s different from other formal verification systems in that it’s very pragmatic. Instead of writing proofs, it works using the simple method of running all possible executions of a program. JANUARY | 2021 | PROBABLY DANCE Currently in the US, something like 26 million people have tested positive for SARS-CoV2, and roughly 440,000 people have died of COVID19. I’m using these terms to make a distinction: Not everyone who gets the virus will get sick, and not everyone who gets sick will die. Let’s be generous and assume that 100 million people got thevirus so
WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE The main point of this is to prove the point that the RTS genre really did splinter into many different directions and subgenres: Ensemble Studios made Halo Wars for consoles and then died. There was also a free-to-play version of Age of Empires made by Gas Powered Games. Some ex-Ensemble people founded Robot Entertainment. MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since A FASTER IMPLEMENTATION OF STD::FUNCTION My implementation beats std::function in all categories, and it beats a virtual function call in optimized builds. In debug builds it is roughly 50% slower than a virtual function call. Which is not ideal, but it is better than other implementations. I think I can live with this. The benefits of std::function still far outweigh the downsides ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could WHY VIDEO GAME AI DOES NOT USE MACHINE LEARNING The classical algorithm then trusts the machine learning part and only looks at the “important” moves when trying to determine which move is best. Anyway with the introductions out of the way, here are the main reasons why video game AI does not use machine learning: 1. Machine Learning is Hard and Far From Solved for Game Playing. A NEW FAST HASH TABLE IN RESPONSE TO GOOGLE’S NEW FAST Hi, I wrote my new favorite hash table. This came about because last year I wrote the fastest hash table (I still make that claim) and this year one of the organizers of the C++Now conference asked me to give a talk. My problem was that Google had also announced a new fast hash table last year, and I wasn’t sure if mine would compare wellagainst theirs.
MAY | 2020 | PROBABLY DANCE Currently much of the country is shut down to stop the spread of the coronavirus and there is very active debate about how soon we should open up again. Some people say as soon as possible, others are saying immediately. Those might sound like similar viewpoints, but “as soon as possible” might be anything from two weeks to two months JULY | 2020 | PROBABLY DANCE Partial Scaling – How to do Half a Multiplication. Programmers have a habit of over-generalizing things, and so it happened that I found myself writing more generalized versions of rotation, translation and scaling, the three most common operations that you’d want to do to 3D objects. These were more generalized in that they had a parameter NOVEMBER | 2020 | PROBABLY DANCE The 2020 US election is finally over, and all the election excitement of the last week reminded me of something I had been meaning to look into: Sergey Shpilkin’s data visualizations that clearly show fraud in Russian elections. I generated the same visualizations for all US presidential elections from 2000 to 2016. OCTOBER | 2020 | PROBABLY DANCE 1 post published by Malte Skarupke during October 2020. TLA+ is a formal specification language that you can use to verify programs. MARCH | 2020 | PROBABLY DANCE A New Strategy Genre Grows Up: Survival Chaos, my New Favorite Game. I’ve had an obsession recently with a mod for Warcraft 3. It’s called Survival Chaos. I want to talk about it because it’s part of a genre of strategy games that hasn’t had a big success yet, andthis
APRIL | 2020 | PROBABLY DANCE The consensus forecast generated by the individual responses indicates that we should expect roughly 19,000 reported cases by March 29. To be fair, they thought that the curve would behave similar as in other countries. They didn’t expect the US government to mess up its response this badly. UNDERSTANDING WHY THE CDC GIVES THE GUIDELINES THAT IT The CDC has minimized the number of people who are upset at it. At a certain point last spring, lots of people were getting upset that the CDC still hadn’t recommended face masks, so they changed their policy. Sure, then there were the expected large amount of people who were mad at it for issuing the new guidelines, but the CDC could seethe
FINDING FLOATING POINT NUMBERS FOR EXACT MATH Let’s say we pick a cost of 1 to go north, east, west or south, and we pick a cost of 1.41 to go diagonally. (the real cost is sqrt (2), but 1.41 should be close enough) Then the first path adds up to 1.41 + 1.41 + 1 = 3.82, and the second path adds up to 1 + 1.41 + 1.41 = 3.82. Except since these are floating point numbers, they don’t add HANDMADE COROUTINES FOR WINDOWS In a previous post I implemented coroutines using the ucontext.h header. In this post I will show a replacement that should be much faster. I will also provide a Windows implementation. I like to start off with some code, so here is the complete code for switching the stack in Linux: All code in this FUNCTIONAL PROGRAMMING IS NOT POPULAR BECAUSE IT IS WEIRD Functional programming is just a bit too weird. To talk about functional programming let’s bake a cake. Taking a recipe from here, this is how you bake an imperative cake: Preheat oven to 175 degrees C. Grease and flour 2 – 8 inch round pans. In a small THE PROBLEMS WITH UNIFORM INITIALIZATION C++11 made the {} syntax for initializing aggregates more widely usable. You can now also use it to call constructors and to initialize with a std::initializer_list. It also allows you to drop the type name in some circumstances. The general recommendation seems to be that you use it as much as possible. But when I ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thingPROBABLY DANCE
Using TLA+ in the Real World to Understand a Glibc Bug. TLA+ is a formal specification language that you can use to verify programs. It’s different from other formal verification systems in that it’s very pragmatic. Instead of writing proofs, it works using the simple method of running all possible executions of a program. A FASTER IMPLEMENTATION OF STD::FUNCTION My implementation beats std::function in all categories, and it beats a virtual function call in optimized builds. In debug builds it is roughly 50% slower than a virtual function call. Which is not ideal, but it is better than other implementations. I think I can live with this. The benefits of std::function still far outweigh the downsides IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could WHY VIDEO GAME AI DOES NOT USE MACHINE LEARNING The classical algorithm then trusts the machine learning part and only looks at the “important” moves when trying to determine which move is best. Anyway with the introductions out of the way, here are the main reasons why video game AI does not use machine learning: 1. Machine Learning is Hard and Far From Solved for Game Playing. WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE The main point of this is to prove the point that the RTS genre really did splinter into many different directions and subgenres: Ensemble Studios made Halo Wars for consoles and then died. There was also a free-to-play version of Age of Empires made by Gas Powered Games. Some ex-Ensemble people founded Robot Entertainment. A NEW FAST HASH TABLE IN RESPONSE TO GOOGLE’S NEW FAST Hi, I wrote my new favorite hash table. This came about because last year I wrote the fastest hash table (I still make that claim) and this year one of the organizers of the C++Now conference asked me to give a talk. My problem was that Google had also announced a new fast hash table last year, and I wasn’t sure if mine would compare wellagainst theirs.
THE PROBLEMS WITH UNIFORM INITIALIZATION C++11 made the {} syntax for initializing aggregates more widely usable. You can now also use it to call constructors and to initialize with a std::initializer_list. It also allows you to drop the type name in some circumstances. The general recommendation seems to be that you use it as much as possible. But when I ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thingPROBABLY DANCE
Using TLA+ in the Real World to Understand a Glibc Bug. TLA+ is a formal specification language that you can use to verify programs. It’s different from other formal verification systems in that it’s very pragmatic. Instead of writing proofs, it works using the simple method of running all possible executions of a program. A FASTER IMPLEMENTATION OF STD::FUNCTION My implementation beats std::function in all categories, and it beats a virtual function call in optimized builds. In debug builds it is roughly 50% slower than a virtual function call. Which is not ideal, but it is better than other implementations. I think I can live with this. The benefits of std::function still far outweigh the downsides IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could WHY VIDEO GAME AI DOES NOT USE MACHINE LEARNING The classical algorithm then trusts the machine learning part and only looks at the “important” moves when trying to determine which move is best. Anyway with the introductions out of the way, here are the main reasons why video game AI does not use machine learning: 1. Machine Learning is Hard and Far From Solved for Game Playing. WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE The main point of this is to prove the point that the RTS genre really did splinter into many different directions and subgenres: Ensemble Studios made Halo Wars for consoles and then died. There was also a free-to-play version of Age of Empires made by Gas Powered Games. Some ex-Ensemble people founded Robot Entertainment. A NEW FAST HASH TABLE IN RESPONSE TO GOOGLE’S NEW FAST Hi, I wrote my new favorite hash table. This came about because last year I wrote the fastest hash table (I still make that claim) and this year one of the organizers of the C++Now conference asked me to give a talk. My problem was that Google had also announced a new fast hash table last year, and I wasn’t sure if mine would compare wellagainst theirs.
FIBONACCI HASHING: THE OPTIMIZATION THAT THE WORLD FORGOT Oh just realized you briefly mentioned it. IMO you’re not giving it enough credit.. neither fibonacci or fastrange will work as a hash function alone, you need a decent hash function to start with, and the benefits of fastrange is that it allows you to use non-pow-of-2 sizes (if you do use power of two sizes it’s true that it’s exactly equivalent to just throwing away the lower bits). FUNCTIONAL PROGRAMMING IS NOT POPULAR BECAUSE IT IS WEIRD Functional programming is just a bit too weird. To talk about functional programming let’s bake a cake. Taking a recipe from here, this is how you bake an imperative cake: Preheat oven to 175 degrees C. Grease and flour 2 – 8 inch round pans. In a small UNDERSTANDING WHY THE CDC GIVES THE GUIDELINES THAT IT The CDC has minimized the number of people who are upset at it. At a certain point last spring, lots of people were getting upset that the CDC still hadn’t recommended face masks, so they changed their policy. Sure, then there were the expected large amount of people who were mad at it for issuing the new guidelines, but the CDC could seethe
C++11 COMPLETED RAII, MAKING COMPOSITION EASIER The addition of move semantics in C++11 is not just a performance and safety improvement. It's also the feature that completed RAII. And as of C++11 I believe that RAII is absolutely necessary to make object composition easy in the language. To illustrate let's look at how objects were composed before C++11, what problems we THE IMPORTANCE OF STD::FUNCTION In C++11 there is a new class in the standard library called std::function. It allows you to store anything that is callable. For example Prints "Hello World!" as you would expect. The assignment to and storage of the two different types is handled internally by the std::function. The amazing thing is that calling a std::function FINDING FLOATING POINT NUMBERS FOR EXACT MATH Let’s say we pick a cost of 1 to go north, east, west or south, and we pick a cost of 1.41 to go diagonally. (the real cost is sqrt (2), but 1.41 should be close enough) Then the first path adds up to 1.41 + 1.41 + 1 = 3.82, and the second path adds up to 1 + 1.41 + 1.41 = 3.82. Except since these are floating point numbers, they don’t addPARTIAL SCALING
Programmers have a habit of over-generalizing things, and so it happened that I found myself writing more generalized versions of rotation, translation and scaling, the three most common operations that you'd want to do to 3D objects. These were more generalized in that they had a parameter for how much you want to do a MARCH | 2020 | PROBABLY DANCE A New Strategy Genre Grows Up: Survival Chaos, my New Favorite Game. I’ve had an obsession recently with a mod for Warcraft 3. It’s called Survival Chaos. I want to talk about it because it’s part of a genre of strategy games that hasn’t had a big success yet, andthis
APRIL | 2020 | PROBABLY DANCE The consensus forecast generated by the individual responses indicates that we should expect roughly 19,000 reported cases by March 29. To be fair, they thought that the curve would behave similar as in other countries. They didn’t expect the US government to mess up its response this badly. MAY | 2020 | PROBABLY DANCE Currently much of the country is shut down to stop the spread of the coronavirus and there is very active debate about how soon we should open up again. Some people say as soon as possible, others are saying immediately. Those might sound like similar viewpoints, but “as soon as possible” might be anything from two weeks to two monthsPROBABLY DANCE
Using TLA+ in the Real World to Understand a Glibc Bug. TLA+ is a formal specification language that you can use to verify programs. It’s different from other formal verification systems in that it’s very pragmatic. Instead of writing proofs, it works using the simple method of running all possible executions of a program. MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE The main point of this is to prove the point that the RTS genre really did splinter into many different directions and subgenres: Ensemble Studios made Halo Wars for consoles and then died. There was also a free-to-play version of Age of Empires made by Gas Powered Games. Some ex-Ensemble people founded Robot Entertainment. IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since A FASTER IMPLEMENTATION OF STD::FUNCTION My implementation beats std::function in all categories, and it beats a virtual function call in optimized builds. In debug builds it is roughly 50% slower than a virtual function call. Which is not ideal, but it is better than other implementations. I think I can live with this. The benefits of std::function still far outweigh the downsides I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could FIBONACCI HASHING: THE OPTIMIZATION THAT THE WORLD FORGOTSEE MORE ONPROBABLYDANCE.COM
ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in FUNCTIONAL PROGRAMMING IS NOT POPULAR BECAUSE IT IS WEIRDFUNCTIONAL PROGRAMMING CONCEPTSFUNCTIONAL PROGRAMMING EXPLAINEDFUNCTIONAL PROGRAMMING LANGUAGESFUNCTIONAL PROGRAMMING STATEFUNCTIONAL PROGRAMMING WIKIPEDIAA PROGRAMMING LANGUAGE Functional programming is just a bit too weird. To talk about functional programming let’s bake a cake. Taking a recipe from here, this is how you bake an imperative cake: Preheat oven to 175 degrees C. Grease and flour 2 – 8 inch round pans. In a small A NEW FAST HASH TABLE IN RESPONSE TO GOOGLE’S NEW FAST Hi, I wrote my new favorite hash table. This came about because last year I wrote the fastest hash table (I still make that claim) and this year one of the organizers of the C++Now conference asked me to give a talk. My problem was that Google had also announced a new fast hash table last year, and I wasn’t sure if mine would compare wellagainst theirs.
PROBABLY DANCE
Using TLA+ in the Real World to Understand a Glibc Bug. TLA+ is a formal specification language that you can use to verify programs. It’s different from other formal verification systems in that it’s very pragmatic. Instead of writing proofs, it works using the simple method of running all possible executions of a program. MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE The main point of this is to prove the point that the RTS genre really did splinter into many different directions and subgenres: Ensemble Studios made Halo Wars for consoles and then died. There was also a free-to-play version of Age of Empires made by Gas Powered Games. Some ex-Ensemble people founded Robot Entertainment. IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since A FASTER IMPLEMENTATION OF STD::FUNCTION My implementation beats std::function in all categories, and it beats a virtual function call in optimized builds. In debug builds it is roughly 50% slower than a virtual function call. Which is not ideal, but it is better than other implementations. I think I can live with this. The benefits of std::function still far outweigh the downsides I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could FIBONACCI HASHING: THE OPTIMIZATION THAT THE WORLD FORGOTSEE MORE ONPROBABLYDANCE.COM
ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in FUNCTIONAL PROGRAMMING IS NOT POPULAR BECAUSE IT IS WEIRDFUNCTIONAL PROGRAMMING CONCEPTSFUNCTIONAL PROGRAMMING EXPLAINEDFUNCTIONAL PROGRAMMING LANGUAGESFUNCTIONAL PROGRAMMING STATEFUNCTIONAL PROGRAMMING WIKIPEDIAA PROGRAMMING LANGUAGE Functional programming is just a bit too weird. To talk about functional programming let’s bake a cake. Taking a recipe from here, this is how you bake an imperative cake: Preheat oven to 175 degrees C. Grease and flour 2 – 8 inch round pans. In a small A NEW FAST HASH TABLE IN RESPONSE TO GOOGLE’S NEW FAST Hi, I wrote my new favorite hash table. This came about because last year I wrote the fastest hash table (I still make that claim) and this year one of the organizers of the C++Now conference asked me to give a talk. My problem was that Google had also announced a new fast hash table last year, and I wasn’t sure if mine would compare wellagainst theirs.
JUNE | 2020 | PROBABLY DANCE The immediate cause is that the police killed another unarmed black man because he was briefly resisting them. But of course it’s pent-up anger from years of police brutality. And of course it couldn’t have come at a worse time with mass-unemployment and a pandemic still raging through the country. All of this didn’t haveto be, so here
MAY | 2020 | PROBABLY DANCE Currently much of the country is shut down to stop the spread of the coronavirus and there is very active debate about how soon we should open up again. Some people say as soon as possible, others are saying immediately. Those might sound like similar viewpoints, but “as soon as possible” might be anything from two weeks to two months AUGUST | 2020 | PROBABLY DANCE These are rare, but the most common implementation is the “Interval Heap” that can be explained quickly, has clean code and is only slightly slower than a binary heap. But there is an alternative called the “Min-Max Heap” that doesn’t have pretty code, but it has shorter dependency chains, which is important on modern hardware. JANUARY | 2021 | PROBABLY DANCE Currently in the US, something like 26 million people have tested positive for SARS-CoV2, and roughly 440,000 people have died of COVID19. I’m using these terms to make a distinction: Not everyone who gets the virus will get sick, and not everyone who gets sick will die. Let’s be generous and assume that 100 million people got thevirus so
APRIL | 2020 | PROBABLY DANCE The consensus forecast generated by the individual responses indicates that we should expect roughly 19,000 reported cases by March 29. To be fair, they thought that the curve would behave similar as in other countries. They didn’t expect the US government to mess up its response this badly. POLITICS AND ECONOMICS You have to write these things down while you still remember them. I was already beginning to forget that there was a toilet paper shortage. Similarly right now the popular thing is to point out that this was predictable and we should have listened to the experts. FINDING FLOATING POINT NUMBERS FOR EXACT MATH Let’s say we pick a cost of 1 to go north, east, west or south, and we pick a cost of 1.41 to go diagonally. (the real cost is sqrt (2), but 1.41 should be close enough) Then the first path adds up to 1.41 + 1.41 + 1 = 3.82, and the second path adds up to 1 + 1.41 + 1.41 = 3.82. Except since these are floating point numbers, they don’t add I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in JUNE | 2011 | PROBABLY DANCE 2 posts published by Malte Skarupke during June 2011. Spore did a neat thing where they stored the creature information in a .png file that was a picture taken of the creature.PROBABLY DANCE
The heap is a data structure that I use all the time and that others somehow use rarely. (I once had a coworker tell me that he knew some code was mine because it used a heap) Recently I was writing code that could really benefit from using a heap (as most code can) but I needed to be able to pop items from both ends. MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE I replayed Warcraft III recently and was looking for other games I could play in the same genre. Turns out that outside of StarCraft 2, there are no recent games that are anywhere near as good. What happened? This blog post was actually prompted by me watching a recommended video on Youtube about exactly this IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since A FASTER IMPLEMENTATION OF STD::FUNCTION As I wrote in my last post, I consider std::function to be a very important class that will change how you design your code, because it means that you have to use inheritance less often.In that post I was very impressed with the performance of std::function when compiled with optimizations. Unfortunately std::function can be far slower than a virtual function call in debug. I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could THE IMPORTANCE OF STD::FUNCTION In C++11 there is a new class in the standard library called std::function. It allows you to store anything that is callable. For example Prints "Hello World!" as you would expect. The assignment to and storage of the two different types is handled internally by the std::function. The amazing thing is that calling a std::function FIBONACCI HASHING: THE OPTIMIZATION THAT THE WORLD FORGOTSEE MORE ONPROBABLYDANCE.COM
ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in A NEW FAST HASH TABLE IN RESPONSE TO GOOGLE’S NEW FAST Hi, I wrote my new favorite hash table. This came about because last year I wrote the fastest hash table (I still make that claim) and this year one of the organizers of the C++Now conference asked me to give a talk. My problem was that Google had also announced a new fast hash table last year, and I wasn’t sure if mine would compare wellagainst theirs.
PROBABLY DANCE
The heap is a data structure that I use all the time and that others somehow use rarely. (I once had a coworker tell me that he knew some code was mine because it used a heap) Recently I was writing code that could really benefit from using a heap (as most code can) but I needed to be able to pop items from both ends. MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE I replayed Warcraft III recently and was looking for other games I could play in the same genre. Turns out that outside of StarCraft 2, there are no recent games that are anywhere near as good. What happened? This blog post was actually prompted by me watching a recommended video on Youtube about exactly this IDEAS FOR A PROGRAMMING LANGUAGE I've been simmering ideas for a programming language for a while. I'll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine. Since A FASTER IMPLEMENTATION OF STD::FUNCTION As I wrote in my last post, I consider std::function to be a very important class that will change how you design your code, because it means that you have to use inheritance less often.In that post I was very impressed with the performance of std::function when compiled with optimizations. Unfortunately std::function can be far slower than a virtual function call in debug. I WROTE THE FASTEST HASHTABLE I had to get there eventually. I had a blog post called “I Wrote a Fast Hashtable” and another blog post called “I Wrote a Faster Hashtable.”Now I finally wrote the fastest hashtable. And by that I mean that I have the fastest lookups of any hashtable I could THE IMPORTANCE OF STD::FUNCTION In C++11 there is a new class in the standard library called std::function. It allows you to store anything that is callable. For example Prints "Hello World!" as you would expect. The assignment to and storage of the two different types is handled internally by the std::function. The amazing thing is that calling a std::function FIBONACCI HASHING: THE OPTIMIZATION THAT THE WORLD FORGOTSEE MORE ONPROBABLYDANCE.COM
ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in A NEW FAST HASH TABLE IN RESPONSE TO GOOGLE’S NEW FAST Hi, I wrote my new favorite hash table. This came about because last year I wrote the fastest hash table (I still make that claim) and this year one of the organizers of the C++Now conference asked me to give a talk. My problem was that Google had also announced a new fast hash table last year, and I wasn’t sure if mine would compare wellagainst theirs.
JUNE | 2020 | PROBABLY DANCE 1 post published by Malte Skarupke during June 2020. An unforeseen disaster is never the consequence of a single factor, but rather is like a whirlwind, a point of cyclonic depression in the consciousness of the world, towards which a whole multiplicity of converging causalities have conspired MAY | 2020 | PROBABLY DANCE 1 post published by Malte Skarupke during May 2020. Currently much of the country is shut down to stop the spread of the coronavirus and there is very active debate about how soon we should open up again. JANUARY | 2021 | PROBABLY DANCE 1 post published by Malte Skarupke during January 2021. The CDC continues to issue very puzzling guidelines about the coronavirus. APRIL | 2020 | PROBABLY DANCE 1 post published by Malte Skarupke during April 2020. You have to write these things down while you still remember them. I was already beginning to forget that there was a toilet paper shortage. AUGUST | 2020 | PROBABLY DANCE The heap is a data structure that I use all the time and that others somehow use rarely. (I once had a coworker tell me that he knew some code was mine because it used a heap) Recently I was writing code that could really benefit from using a heap (as most code can) but POLITICS AND ECONOMICS You have to write these things down while you still remember them. I was already beginning to forget that there was a toilet paper shortage. Similarly right now the popular thing is to point out that this was predictable and we should have listened to the experts. FINDING FLOATING POINT NUMBERS FOR EXACT MATH For the second time in my career, I ran into a problem where it's actually useful to know how floating point numbers work. (first time was here) The problem is that sometimes you want floating point numbers that add well. So that you have the associativity guarantee that (a + b) + c == a ANOTHER OPINION ON “ALMOST ALWAYS AUTO” Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with "almost always auto" in Scala. I disagree with it in C++. And that's because there is a slight difference in syntax for type inference between the two languages. Here's type deduction in FUNCTIONAL PROGRAMMING IS NOT POPULAR BECAUSE IT IS WEIRD I've seen people be genuinely puzzled about why functional programming is not more popular. For example I'm currently reading "Out of the Tar Pit" where after arguing for functional programming the authors say Still, the fact remains that such arguments have been insufficient to result in widespread adoption of functional programming. We musttherefore conclude
JUNE | 2011 | PROBABLY DANCE 2 posts published by Malte Skarupke during June 2011. Spore did a neat thing where they stored the creature information in a .png file that was a picture taken of the creature.PROBABLY DANCE
I can program and like gamesJUNE 7, 2020
THINKING TOOLS FOR THE CURRENT US MESS > An unforeseen disaster is never the consequence of a single factor, > but rather is like a whirlwind, a point of cyclonic depression in > the consciousness of the world, towards which a whole multiplicity > of converging causalities have conspired>
> – Carlo Emilio Gadda (in That Awful Mess on the Via Merulana) It’s hard for me to write a focused blog post at the moment because there just seem to be too many active problems. I could have written a focused blog post about a programming topic, but that feels tone-deaf. So instead this will be a scatter-shot blog post about ways of thinking that could help us out of this mess. Also, since I usually write about programming, I will try to feed the lessons back toprogramming.
For context (if you’re reading this in the future or from another country) the US has had a really bad year. We nearly started a war with Iran, we impeached our president but couldn’t get him out of office, and then we completely failed our response to the global pandemic. After initially doing nothing and hoping it would just go away, the US decided to react in the most costly way possible, causing mass unemployment while still proving mostly impotent in fighting the virus. Now, after that huge sunk cost, we have mostly given up on fighting the coronavirus, just in time for a new problem to arise: Massive amounts of protests all over the country, some of which even turned into riots. The immediate cause is that the police killed another unarmed black man because he was briefly resisting them. But of course it’s pent-up anger from years of police brutality. And of course it couldn’t have come at a worse time with mass-unemployment and a pandemic still raging through the country. All of this didn’t have to be, so here are some helpful tools ofthought:
Read the rest of this entry »Leave a comment
MAY 3, 2020
THE COVID-SHUTDOWNS ARE ACTUALLY A GREAT CIVICS LESSON Currently much of the country is shut down to stop the spread of the coronavirus and there is very active debate about how soon we should open up again. Some people say as soon as possible, others are saying immediately. Those might sound like similar viewpoints, but “as soon as possible” might be anything from two weeks to two months, depending on who you ask. There’s also a lot of debate about how deadly a second wave would actually be if we opened up the country with few or no restrictions. What percentage would get the virus? How many of those would die? Uncertainty about all of those numbers is slowly decreasing and it seems like the reopening will happen sooner rather than later. But I want to frame the debate about how it’s actually a great civics lesson. It shows how the government is really of the people, by the people and for the people, and how it can only do things that the people allow it to do. It also neatly shows how we need the government to do things that everyone wants to happen, but that they can’t make happen on their own. Read the rest of this entry »Leave a comment
APRIL 12, 2020
A NEW YORK HISTORY OF COVID-19, WRITTEN AT THE HALF-WAY POINT You have to write these things down while you still remember them. I was already beginning to forget that there was a toilet paper shortage. Similarly right now the popular thing is to point out that this was predictable and we should have listened to the experts. But the experts were predicting that this would be much less bad:
> The consensus forecast generated by the individual responses > indicates that we should expect roughly 19,000 reported cases by> March 29
To be fair, they thought that the curve would behave similar as in other countries. They didn’t expect the US government to mess up its response this badly. Another thing that people are already forgetting is what “flatten the curve” meant. It was supposed to be a strategy to avoid the quarantine lockdown that we all now live in. Western countries didn’t want to do what China did, and “flattening the curve” was the appealing alternative. A lot of these things can only be understood in context, because things are changing so incredibly quickly that it feels like we’re living in a whole new world every couple weeks, and we forget. So lets start at the beginning while westill remember:
Read the rest of this entry »2 Comments
MARCH 28, 2020
A NEW STRATEGY GENRE GROWS UP: SURVIVAL CHAOS, MY NEW FAVORITE GAME I’ve had an obsession recently with a mod for Warcraft 3. It’s called Survival Chaos. I want to talk
about it because it’s part of a genre of strategy games that hasn’t had a big success yet, and this feels like a big evolution, maybe even a breakthrough. It’s rare to see a new video game genre emerge like this, and nobody ever writes about this while it’s happening. The history of Auto Chess, the other recent genre to come out of Warcraft 3, is almost completely lost. (I was able to find a very similar map called “Pokemon Defense” from 2010
, but that’s about it…) I am not sure if the genre has a good name yet since it’s never been big. In StarCraft 2 it’s called “Tug Of War” so I’ll go with that. The basic idea is to make a RTS where you don’t control your units. You just build buildings, the buildings automatically make units, and you watch the units fight automatically. You mostly make decisions about the macro: When to invest in your economy, what units you should invest in, what upgrades you should get. Before we go any further though, let’s just watch a video of someone playing thegame:
Read the rest of this entry »2 Comments
JANUARY 29, 2020
WHY VIDEO GAME AI DOES NOT USE MACHINE LEARNING I used to be an AI programmer working on video games, and I’m currently trying to learn machine learning. As part of this I find myself having to repeatedly explain why video games don’t use machine learning. People seem to find it interesting enough because it’s not just the obvious reasons (machine learning is hard and far from solved for game playing) but it’s also about developer control and about making an understandable game for the player. Video game AI is designed to deliver a certain experience, which is more difficult to do with machine learning. So this blog post lists the main reasons why video game AI does not use machine learning. Read the rest of this entry »1 Comment
DECEMBER 30, 2019
MEASURING MUTEXES, SPINLOCKS AND HOW BAD THE LINUX SCHEDULERREALLY IS
This blog post is one of those things that just blew up. From a tiny observation at work about odd behaviors of spinlocks I spent months trying to find good benchmarks, (still not entirely successful) writing my own spinlocks, mutexes and condition variables and even contributing a patch to the Linux kernel. The main thing I’ll try to answer is to give some more informed guidance on the endless discussion of mutex vs spinlock. Besides that I found that most mutex implementations are really good, that most spinlock implementations are pretty bad, and that the Linux scheduler is OK but far from ideal. The most popular replacement, the MuQSS scheduler has other problems instead. (the Windows scheduler is pretty good though) So this all started like this: I overheard somebody at work complaining about mysterious stalls while porting Rage 2 to Stadia. (edit disclaimer: This blog post got more attention than anticipated, so I decided to clarify that I didn’t work on the Rage 2 port to Stadia. As far as I know that port was no more or less difficult than a port to any other platform. I am only aware of this problem because I was working in the same office as the people who were working on the port. And the issue was easily resolved by using mutexes instead of spinlocks, which will become clear further down in the blog. All I did was further investigation on my own afterwards. edit end) The only thing those mysterious stalls had in common was that they were all using spinlocks. I was curious about that because I happened to be the person who wrote the spinlock we were using. The problem was that there was a thread that spent several milliseconds trying to acquire a spinlock at a time when no other thread was holding the spinlock. Let me repeat that: The spinlock was free to take yet a thread took multiple milliseconds to acquire it. In a video game, where you have to get a picture on the screen every 16 ms or 33 ms (depending on if you’re running at 60hz or 30hz) a stall that takes more than a millisecond is terrible. Especially if you’re literally stalling all threads. (as was happening here) In our case we were able to make the problem go away by replacing spinlocks with mutexes, but that leads to the question: How do you even measure whether a spinlock is better than a mutex, and what makes a good spinlock? Read the rest of this entry »86 Comments
SEPTEMBER 11, 2019
WHAT HAPPENED TO THE REAL TIME STRATEGY GENRE I replayed Warcraft III recently and was looking for other games I could play in the same genre. Turns out that outside of StarCraft 2, there are no recent games that are anywhere near as good. Whathappened?
This blog post was actually prompted by me watching a recommended video on Youtube about exactly this question, and the video gets ittotally wrong:
The video really doesn’t answer the question, so lets look at what’s actually happening. Starting with whether strategy games somehow became less popular. The answer: Not really. Read the rest of this entry »11 Comments
AUGUST 28, 2019
A NEW ALGORITHM FOR CONTROLLED RANDOMNESS I don’t know if this problem has a proper name, but in game development you usually don’t want truly random numbers. I’ve seen the solution named a “pseudo random distribution” but
“pseudo random” already has a different meaning outside of game design, so I will just call it controlled randomness for this blogpost.
The description of the problem is this: An enemy is supposed to drop a crucial item 50% of the time. Players fight this enemy over and over again, and after fighting the enemy ten times the item still hasn’t dropped. They think the game is broken. Or an attack is supposed to succeed 90% of the time but misses three times in a row. Players will think the game is broken. In this blog post I want to expand that problem to the situation where you not only have two choices (success or fail) but many choices. For example you want to create traffic on a road and spawn a bunch of random cars without having the same car too many times. The problem was already partially solved for the success/fail case, and in this blog post I will improve on that solution and present the solution for the case where there are many choices. I will also allow you to control exactly how random or non-random you want the result to be. If you’re fine with a 90% success chance to fail three times in a row in certain situations, but want it to be more reliable in other situations, you will be able to tweak that witha number.
Read the rest of this entry »3 Comments
JUNE 8, 2019
TREASURE HUNTING SYSTEMS FOUND IN THE HISTORY OF VIDEO GAMES A treasure hunting system is a system that unexpectedly puts out really good stuff. Proper treasure that makes people an enormous amount of money. An example is the Warcraft III modding community which invented several new genres of games and sprouted DotA, whose clones and offspring made their creators rich. (I don’t know how much money exactly, but Riot Games got acquired for $400 million, and their only product is a DotA-clone) This has happened several times in the history of video games, but I didn’t link these together until I recently saw a talk about the Czechoslovakian game developer community before the iron curtain fell. The presenter talked about how the small country of Czechoslovakia had a thriving video game community despite the fact that you couldn’t buy computers in Czechoslovakia. But when I saw the talk I couldn’t help but think that “this reminds me of the Warcraft 3 modding community,” so I figured I should write up what these and other historical examples have in common so that we can build more systems that generate treasures. Read the rest of this entry »3 Comments
APRIL 24, 2019
ON A FUTURE OF SCREEN-LESS COMPUTERS The current problem with computers was well articulated in the pieceThe Machine Stops
by
the late Oliver Sacks: > I cannot get used to seeing myriads of people in the street peering > into little boxes or holding them in front of their faces, walking > blithely in the path of moving traffic, totally out of touch with > their surroundings. I am most alarmed by such distraction and > inattention when I see young parents staring at their cell phones > and ignoring their own babies as they walk or wheel them along. Such > children, unable to attract their parents’ attention, must feel > neglected, and they will surely show the effects of this in the> years to come.
>
>
>
> These gadgets have now immersed us in a virtual reality far > denser, more absorbing, and even more dehumanizing. I am confronted > every day with the complete disappearance of the old civilities. > Social life, street life, and attention to people and things around > one have largely disappeared, at least in big cities, where a > majority of the population is now glued almost without pause to > phones or other devices—jabbering, texting, playing games, turning > more and more to virtual reality of every sort. It reminded me of this quote by Wilson Miner: > The car shaped our environment in the 20th century in this huge, > tectonic way. I don’t think it’s a stretch to say that the > screen will be as important to shaping our environment in the 21st> century.
I’m not sure if he meant this as a warning, but considering how little we like being in neighborhoods that are built more for cars than for pedestrians, I think it should be interpreted as one. Read the rest of this entry »Leave a comment
Older
Older posts
Search for:
RECENT POSTS
* Thinking Tools for the Current US Mess * The Covid-Shutdowns are Actually a Great Civics Lesson * A New York History of Covid-19, Written at the Half-Way Point * A New Strategy Genre Grows Up: Survival Chaos, my NewFavorite Game
* Why Video Game AI does not Use Machine LearningARCHIVES
* June 2020
* May 2020
* April 2020
* March 2020
* January 2020
* December 2019
* September 2019
* August 2019
* June 2019
* April 2019
* March 2019
* June 2018
* May 2018
* April 2018
* January 2018
* December 2017
* November 2017
* October 2017
* September 2017
* August 2017
* February 2017
* January 2017
* December 2016
* November 2016
* June 2016
* April 2016
* March 2016
* February 2016
* December 2015
* September 2015
* July 2015
* June 2015
* May 2015
* February 2015
* January 2015
* December 2014
* November 2014
* October 2014
* September 2014
* August 2014
* June 2014
* May 2014
* April 2014
* March 2014
* February 2014
* January 2014
* October 2013
* September 2013
* August 2013
* May 2013
* February 2013
* January 2013
* December 2012
* November 2012
* October 2012
* August 2012
* July 2012
* April 2012
* March 2012
* February 2012
* January 2012
* October 2011
* September 2011
* August 2011
* July 2011
* June 2011
* May 2011
CATEGORIES
* Games
* Links
* Politics and Economics* Programming
* Uncategorized
META
* Register
* Log in
* Entries feed
* Comments feed
* WordPress.com
Blog at WordPress.com.Post to
Cancel
* Follow
*
* Probably Dance
* Customize
* Follow
* Sign up
* Log in
* Report this content * Manage subscriptions* Collapse this bar
Details
Copyright © 2024 ArchiveBay.com. All rights reserved. Terms of Use | Privacy Policy | DMCA | 2021 | Feedback | Advertising | RSS 2.0