GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    Hazel Weakly (hazelweakly@hachyderm.io)'s status on Saturday, 16-Aug-2025 14:11:49 JST Hazel Weakly Hazel Weakly
    • Mauricio Teixeira 🇧🇷🇺🇲

    @badnetmask Great question!

    I typically like to relocate code to an internal library where that code becomes interesting and topical rather than boring. If that’s not the best choice, I might put it in a different module. Really what I’m trying to do is go from “I wrote this for internally relevant reasons” to “here’s how we solve this specific issue in this context given this motivation”

    As an example, one could imagine writing a weird hacky inverse square root function that happens to work pretty well. Sure, you could just stick it in the code and comment “wtf?” (Like the historical implementation did: https://en.wikipedia.org/wiki/Fast_inverse_square_root). After all it’s “just” a quirky performance optimization of a common function. But how am I going to find that code and know what to do with it when/if hardware advances make it obsolete in the future? And how do I explain why we even did this?

    If it’s just buried somewhere in a codebase, it’s hard to find. Doubly so if it’s “boring” code. It’d probably end up in a random utils file if we didn’t just inline it in the few places it’s used in… But if it’s in a library that implements hardware optimized mathematical functions? Now it’s interesting and relevant *and* I can much better understand when to evolve the code in the future.

    In conversation about a year ago from hachyderm.io permalink

    Attachments

    1. Domain not in remote thumbnail source whitelist: upload.wikimedia.org
      Fast inverse square root
      Fast inverse square root, sometimes referred to as Fast InvSqrt() or by the hexadecimal constant 0x5F3759DF, is an algorithm that estimates 1 x {\displaystyle {\frac {1}{\sqrt {x}}}} , the reciprocal (or multiplicative inverse) of the square root of a 32-bit floating-point number x {\displaystyle x} in IEEE 754 floating-point format. This...

    Feeds

    • Activity Streams
    • RSS 2.0
    • Atom
    • Help
    • About
    • FAQ
    • TOS
    • Privacy
    • Source
    • Version
    • Contact

    GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

    Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.