Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K

    Mathias Bynens

    mathiasbynens.be · Personal blog · on HN since 2010

    Mathias Bynens, a web developer and JavaScript engine contributor, writes about Unicode, JavaScript internals, and web standards.

    Visit blogHN submissions
    Web DevelopmentLanguages & Compilers
    What HN says

    HN commenters link his URL validation regex demo, his JavaScript Unicode essays, and his globalThis notes, calling them worth saving.

    Stats for nerds
    123HN people shared it
    94linked in comments
    1.8Kstory points
    Jun 2026last shared
    2014people per year2026

    Top posts on HN

    1. 1
      In search of the perfect URL validation regex (2010)
      7 people · 318 points · first shared 2014 · 81 comments on HN
    2. 2
      Plain text wrapping in Gmail
      1 person · 171 points · first shared 2014 · 90 comments on HN
    3. 3
      A horrifying globalThis polyfill in JavaScript
      7 people · 169 points · first shared 2019 · 73 comments on HN
    4. 4
      ECMAScript regular expressions are getting better (2017)
      5 people · 155 points · first shared 2017 · 103 comments on HN
    5. 5
      Using CSS without HTML
      4 people · 126 points · first shared 2012 · 25 comments on HN
    6. 6
      JavaScript has a Unicode problem (2013)
      12 people · 91 points · first shared 2013 · 35 comments on HN
    7. 7
      Valid JavaScript variable names
      7 people · 91 points · first shared 2012 · 39 comments on HN
    8. 8
      JavaScript Engine Fundamentals: Shapes and Inline Caches
      9 people · 90 points · first shared 2018 · 8 comments on HN
    9. 9
      The smallest possible valid (X)HTML documents
      4 people · 82 points · first shared 2011 · 1 comments on HN
    10. 10
      Shell script Mac Apps
      2 people · 72 points · first shared 2010 · 15 comments on HN

    What HN people wrote when they linked it

    • adev_May 2020

      > If it's really common for everything to become a performance bottleneck, it's worth profiling from the start so that you avoid having major pitfalls anywhere. If it's rare and exceptional, FFI for those cases is fine.

      You can have it both way, code evolve. It is pretty common in performance critical code that a minor, almost never call function in one scenario, become a performance critical bottleneck in an other. If you already played with large scaled simulation software, this happened almost every week depending of your inputs on what you are interested to simulate.

      > On the contrary. Plenty of people do those kind of things in, say, Java. They require knowing about compiler internals and using unsupported hints, or even bypassing parts of the compiler

      No it's not again. I have been developing in C++ for 15 years, including in the HPC world and I (close to) never had to touch a compiler internal.
      The language gives you what you need for performances, you do not need to play with that.

      At the opposite JIT compilers like V8 or Java are monster of complexity very sensible to side effect [1] and controlling things like "Does this data fit in my L2 cache ?" in them is close to impossible because even things like "Where are my data and what are there size ?" is an hard question.

      Once again, there is theory and there is practice.

      Theory is what you say. Practice is that 98% of performance critical software in HPC, game industry, physics and High Frequency Trading is in…

    • StratoscopeDec 2019

      Both of your examples have invalid sort comparator functions.

      A JavaScript sort comparator is required to not only return a positive or negative value, it must handle all three cases: greater than, less than, or equal. When the arguments compare equal, the comparator must return 0.

      Returning only a positive or negative value is a very common error. (I don't mean to pick on you for this! I have seen the error so often that I hope this may be helpful for anyone writing a sort comparator.)

      The invalid comparator will force the normally stable sort to be unstable, because sort() now has no way to know that two items should be considered equal and their existing order preserved.

      Let's demonstrate with the "doggos" example that the article links to:

      https://mathiasbynens.be/demo/sort-stability

      The code starts with this array:

      const doggos = [
      { name: 'Choco', rating: 12 },
      { name: 'Devlin', rating: 13 },
      { name: 'Eagle', rating: 13 },
      { name: 'Jenny', rating: 13 },
      { name: 'Kona', rating: 13 },
      { name: 'Leila', rating: 13 },
      { name: 'Milly', rating: 14 },
      { name: 'Molly', rating: 12 },
      { name: 'Nova', rating: 12 },
      { name: 'Oliver', rating: 13 },
      { name: 'Patches', rating: 14 },
      ];

      It uses this valid comparator:

      doggos.sort( ( a, b ) => b.rating - a.rating );

      (Note that this implements a reverse sort as can be seen in the output on the test page.)

      Subtraction provides the proper…

    • devyNov 2015

      In my own experience, the biggest unicode implementation failure was MySQL's choice of using 3-byte BMP Only UTF-8 instead of a full 4-byte Unicode support.[1] In retrospect, their decision to go with a broken subset implementation had caused more trouble, confusions and incompatibilities than their claimed benefits of speed/performance/simplification. Do a simple google search will see almost everyone recommends avoid `utf8` and use `utf8mb4` instead. [2][3][4]

      As a result, if your MySQL databases/tables/columns are using `utf8` instead of `utf8mb4` (a MySQL invention) charset, you cannot store / retrieve emoji characters properly.

      [1] https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html

      [2] https://mzsanford.wordpress.com/2010/12/28/mysql-and-unicode/

      [3] https://mathiasbynens.be/notes/mysql-utf8mb4

      [4] https://www.drupal.org/node/1314214

    • remexreJun 2021

      Taking a look at that, I think shapes would still work; [1] has some background material on them, but dynamically changing data is what shapes are for; you check if you should update an object's shape when assigning to it, and can JIT based on the type (you ought to be able to handle getattr and setattr with this too, JITting to a direct call to that method when it's necessary). Where this completely falls down in optimizing Python is that it changes the object layout, so you can't pass these to CPython without making them generic and converting them back after. Converting the layout to be generic would be a deep copy (which of course is semantics-breaking), converting it back wouldn't even be possible if the C code kept a reference to it around.

      [1]: https://mathiasbynens.be/notes/shapes-ics

    • mschuster91Feb 2019

      > It's one less network request, saves bandwidth

      Given that most stuff these days is packed together with Webpack or at least concat'd together, you don't really save much, plus jQuery in gzip'd form is clocking in at <30 kB anyway (https://mathiasbynens.be/demo/jquery-size).

      > and pretty much unmaintained code (at this point, the jQuery github is as good as dead, unlikely to see major releases any time soon)

      So what? Software can very well be "done", there is no need to always evolve and evolve. As long as there is no security issue left unsolved, though.

      In addition, if you're rebuilding half of it on your own anyway, chances are high you'll miss some weird corner case that jQuery solved years, or decades, ago.

    • nirvdrumMay 2023

      I found [1] to be a pretty good summary of the key concepts that support the claim. The article, unfortunately, doesn't come right out and say it. But, it talks about how object shapes (a common JS object model) can be used as guards for inline caches (IC) to generate efficient machine code for property access. If you add a new property, you change the shape, which causes the cache guard to fail. That leads to deoptimization since the assumptions made about the call site when the code was compiled no longer hold. That call site is now either polymorphic or megamorphic, depending on the type of IC used and its level of polymorphism.

      [1] -- https://mathiasbynens.be/notes/shapes-ics

    Related

    Jake Archibaldjakearchibald.com191 people

    I discovered a browser bug

    Jake Archibald
    Personal · last shared 2026
    Jens Oliver Meiertmeiert.com47 people

    Ignore AMP

    Jens Oliver Meiert
    Personal · last shared 2026
    Henri Sivonenhsivonen.fi47 people

    String Lengths in Unicode

    Henri Sivonen
    Personal · last shared 2025
    Hillel Waynehillelwayne.com294 people

    1/0 = 0

    Hillel Wayne
    Personal · last shared 2026
    Pony Fooponyfoo.com54 people

    The Controversial State of JavaScript Tooling

    Pony Foo
    Personal · last shared 2022
    2ality2ality.com267 people

    Temporal: Getting started with JavaScript's new date time API

    2ality
    Personal · last shared 2026
    Fredrik Lundheffbot.org64 people

    Simple Top-Down Parsing in Python

    Fredrik Lundh
    Personal · last shared 2023
    David Nolenswannodette.github.io98 people

    The Future of JavaScript MVCs

    David Nolen
    Personal · last shared 2025