The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,182 other subscribers

Archive for the ‘Algorithms’ Category

UTC and ISO 8601, or GTFO

Posted by jpluimers on 2022/11/08

Always schedule your meetings in UTC, and use ISO-8601 date and time notation. Because time zone conversions are hard, especially with so many daylight saving time conventions.

I want not just a “UTC or GTFO” shirt, but a “UTC and ISO-8601, or GTFO” shirt.

It means I do not agree with [Archive.is] Colin Nederkoorn on Twitter: “Pro tip: Don’t schedule recurring meetings in UTC if you live in a place with daylight savings.… “ with multi-time zone teams: having it in UTC will balance out the DST changes over the teams.

Some more relevant Tweets that triggered me writing this post:

Read the rest of this entry »

Posted in Algorithms, Development, ISO 8601, Power User, Software Development, UTC | Leave a Comment »

Days since last time zone issue

Posted by jpluimers on 2022/02/24

If you do business with for instance Jordan for he first time, then is likely -1 because tomorrow their clock moves forward one hour.

The 2022 daylight saving time changes (summer time / winter time) are at time.is/DST_2022 [Wayback/Archive.is]

[Archive.is] Dr. Jessie Christianstein 👩🏻‍🔬🧟‍♀️ on Twitter: “… “

–jeroen

Read the rest of this entry »

Posted in Algorithms, Development, Software Development | Leave a Comment »

When floating point code suddenly becomes orders magnitudes slower (via C++ – Why does changing 0.1f to 0 slow down performance by 10x? – Stack Overflow)

Posted by jpluimers on 2022/01/26

When working with converging algorithms, sometimes floating code can become very slow. That is: orders of magnitude slower than you would expect.

A very interesting answer to [Wayback] c++ – Why does changing 0.1f to 0 slow down performance by 10x? – Stack Overflow.

I’ve only quoted a few bits, read the full question and answer for more background information.

Welcome to the world of denormalized floating-point! They can wreak havoc on performance!!!

Denormal (or subnormal) numbers are kind of a hack to get some extra values very close to zero out of the floating point representation. Operations on denormalized floating-point can be tens to hundreds of times slower than on normalized floating-point. This is because many processors can’t handle them directly and must trap and resolve them using microcode.

If you print out the numbers after 10,000 iterations, you will see that they have converged to different values depending on whether 0 or 0.1 is used.

Basically, the convergence uses some values closer to zero than a normal floating point representation dan store, so a trick is used called “denormal numbers or denormalized numbers (now often called subnormal numbers)” as described in Denormal number – Wikipedia:

In a normal floating-point value, there are no leading zeros in the significand; rather, leading zeros are removed by adjusting the exponent (for example, the number 0.0123 would be written as 1.23 × 10−2). Denormal numbers are numbers where this representation would result in an exponent that is below the smallest representable exponent (the exponent usually having a limited range). Such numbers are represented using leading zeros in the significand.

Since a denormal number is a boundary case, many processors do not optimise for this.

–jeroen

Posted in .NET, Algorithms, ARM, Assembly Language, C, C#, C++, Delphi, Development, Software Development, x64, x86 | Leave a Comment »

The IDEA project – an ongoing series of nonverbal algorithm assembly instructions

Posted by jpluimers on 2021/12/10

I wonder how many new algorithms were added, as the first 6 were really impressive: [WayBackIDEA on Twitter: “Excited to announce the IDEA project – an ongoing series of nonverbal algorithm assembly instructions: https://t.co/zOAyfOAv3l… https://t.co/epQfBBdzdF”

While originally scheduling this, these were added:

  • [WayBack] GIFT WRÄPPING

    The gift wrapping algorithm is an algorithm for computing the convex hull of a set of points, the smallest area containing all points that has no inward-pointing dents. You get a similar result when putting a rubber band around some nails in the wall!

  • [WayBack] KVICK SÖRT

    Quicksort is an efficient sorting algorithm based on a divide and conquer approach. Choosing the dividing element at random is a good strategy to avoid bad worst-case runtime.

  • [WayBack] BOGO SÖRT

    Bogo sort, also known as stupid sort, is a simple, but highly inefficient sorting algorithm, which simply shuffles the elements until they are sorted.

  • [WayBack] PUBLIK KEY KRYPTO

    Public-key cryptography can be used for (at least) two purposes: A person’s public key can be used to send encrypted messages to the keys’ owner.

This in addition to the already existing ones:

  • [WayBack] BINÄRY SEARCH

    Binary search is a fast algorithm for finding the position of a value within a sorted array. It reflects the way people intuitively guess numbers by repeatedly asking Is your number bigger or smaller than x?

  • [WayBack] MERGE SÖRT

    Merge sort is a recursive sorting algorithm based on a divide and conquer approach.

  • [WayBack] BÄLÄNCE TREE

    An AVL tree is a datastructure which guarantees fast search, insertion, and deletion of items. It’s a self-balancing variant of the _binary search tree_.

  • [WayBack] GRÅPH SKÄN

    The graph scan algorithm traverses all reachable nodes in a graph. Its behaviour can be changed by plugging in different datastructures:

  • [WayBack] ONE STRÖKE DRÅW

    This page describes Fleury’s algorithm, an elegant method to find an Eulerian path in a graph — a path which visits every edge exactly once.

–jeroen

Read the rest of this entry »

Posted in Algorithms, Development, Software Development | Leave a Comment »

Constructing Suffix Trees: Ukkonen’s algorithm – Wikipedia

Posted by jpluimers on 2021/10/12

For my link archive:

I also need to check out [WayBack] Martin Farach-Colton – Wikipedia, as his algorithm is likely more optimised and more versatile.

–jeroen

Read the rest of this entry »

Posted in .NET, Algorithms, C#, Development, JavaScript/ECMAScript, Ruby, Scripting, Software Development | Leave a Comment »

 
%d bloggers like this: