How Many Lines of C It Takes to Execute a and B in Python?

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • CPython

    The Python programming language

  • Your "just in case the software is exposed to the web" should be "exposed to untrusted data." The very old Python hash could be DoS'ed reading a data file. The original randomized version required some feedback to figure out the hash, so generally required some sort of interaction.

    I find that hard to believe that's a performance bottleneck. String hashes are all cached, and names like "print" are interned.

    For a 2x overall gain I would expect to see the hash function pop up easily in my profiling, but I haven't seen it in my own profiling which was looking for simple things like that.

    When siphash was evaluated, quoting https://peps.python.org/pep-0456/#performance , "In general the PEP 456 code with SipHash24 is about as fast as the old code with FNV" and "The summarized total runtime of the benchmark is within 1% of the runtime of an unmodified Python 3.4 binary".

    Since then they switched from siphash24 to the faster siphash13. https://github.com/python/cpython/pull/28752

  • rustc-hash

    Custom hash algorithm used by rustc (plus hashmap/set aliases): fast, deterministic, not secure

  • Which is why the Rust compiler itself uses a non-cryptographic hash, which takes just 3 x86 instructions and can work on 8 bytes at a time: <https://github.com/rust-lang/rustc-hash/blob/master/src/lib....>

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • toast

    Time Ordered Astrophysics Scalable Tools (by hpc4cmb)

  • I have a real life example in this commit: https://github.com/hpc4cmb/toast/pull/380/commits/a38d1d6dbc...

    Replacing 2 lines of python code (with tens of glue code in Numba) with hundreds lines of C++ with glue code.

  • uBlock

    uBlock Origin - An efficient blocker for Chromium and Firefox. Fast and lean.

  • If you have no knowledge you can still make use of element picker in the context menu. In this case though the problematic element will have a generated class name like `frontend-components-SubscribePrompt-`, so I resorted to the CSS syntax (`##`). There are a lot, a freaking lot of them [1] but the CSS syntax alone can achieve a lot.

    [1] https://github.com/gorhill/uBlock/wiki/Static-filter-syntax

  • ideas

  • Recent CPython development has been towards optimizations and addressing use cases that benefit from optimizations, some coming from the faster CPython initiative. You might just get your JIT[1].

    [1] https://github.com/faster-cpython/ideas/wiki/Workflow-for-3....

  • kill-sticky

    Bookmarklet to remove sticky elements and restore scrolling to web pages!

  • noscript

    The popular NoScript Security Suite browser extension.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • duckduckgo-locales

    Translation files for <a href="https://duckduckgo.com"> </a>

  • cpython

    Python, but with pluggable malloc (by JacksonKearl)

  • A template repo can be found here https://github.com/JacksonKearl/cpython, but it does not implement an ideal malloc as I am not sure if it is still being used as an assignment.

    The repo states that even this dummy implementation:

    > has a 60% faster startup as compared to base CPython, and in some test cases has marginally better runtime performance as well.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts