Could this code calculating primes be much more optimized?

This page summarizes the projects mentioned and recommended in the original post on /r/prolog

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • Primes

    Prime Number Projects in C#/C++/Python

  • That's worse than the kind of difference I was expecting; but still, it's a micro-optimization benchmark which depends on being able to have fine control over not overflowing the CPU caches, and enough people willing to spend a lot of effort tuning. Or cheating; this Lisp one seems to calculate the Primes as a reader-macro-expansion, before compile time, then runtime is ridiculously fast.

  • swipl-devel

    SWI-Prolog Main development repository

  • $ swipl Welcome to SWI-Prolog (threaded, 64 bits, version 8.5.10) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details. For online help and background, visit https://www.swi-prolog.org For built-in help, use ?- help(Topic). or ?- apropos(Word). ?- [fm2gp_primes]. true. ?- time( setup_call_cleanup(open('prolog-primes.txt', write, Out), with_output_to(Out, primes(500_000)), close(Out)) ). % 8,766,852 inferences, 1.055 CPU in 1.198 seconds (88% CPU, 8311018 Lips) Out = (0x600000648100).

  • 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
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