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

Related tags

Containers Primes
Overview

Primes | A Software Drag Race

Source code to Dave's Garage video benchmarking the same prime number sieve in Python, C#, and C++.

Software Drag Racing | Dave's Garage

Community contributions

For community contributions, see the drag-race branch. If you want to add your own solution, please read CONTRIBUTING.md.

Comments
  • New solution_4 for C#

    New solution_4 for C#

    Description

    Adds a new C# solution. This is based off of the C# solution_2, with one main difference. It uses a bool[] instead of a ulong[]. This will result in 8-bit flags instead of 1-bit, but it means we don't need to do math manually, can use IndexOf on the array to find the next unmarked slot, and can more easily slice and follow patterns friendly to avoiding bounds checking.

    Contributing requirements

    • [X] I read the contribution guidelines in CONTRIBUTING.md.
    • [X] I placed my solution in the correct solution folder.
    • [X] I added a README.md with the right badge(s).
    • [X] I added a Dockerfile that builds and runs my solution.
    • [X] I selected drag-race as the target branch.
    • [X] All code herein is licensed compatible with BSD-3.
    opened by stephentoub 3
  • Rust - initial source

    Rust - initial source

    Description

    Contributing requirements

    • [ x] I read the contribution guidelines in CONTRIBUTING.md.
    • [x ] I placed my solution in the correct solution folder.
    • [x ] I added a README.md with the right badge(s).
    • [x ] I added a Dockerfile that builds and runs my solution.
    • [x ] I selected drag-race as the target branch.
    • [x ] All code herein is licensed compatible with BSD-3.
    opened by jesper-olsen 0
  • main.cpp

    main.cpp

    new sieve implementation maybe. i don't know if this is really new implementation i just got this idea and it gave me good result on my pc when I run it. 👍hope you like it

    Description

    Contributing requirements

    • [ ] I read the contribution guidelines in CONTRIBUTING.md.
    • [ ] I placed my solution in the correct solution folder.
    • [ ] I added a README.md with the right badge(s).
    • [ ] I added a Dockerfile that builds and runs my solution.
    • [ ] I selected drag-race as the target branch.
    • [ ] All code herein is licensed compatible with BSD-3.
    opened by imoe0x63 0
  • kermit solution

    kermit solution

    Description

    This PR includes a ckermit implementation of a prime sieve, it outputs like q3w3e3;1;75;algorithm=base,faithful=no when the image created by the dockerfile is run.

    The implementation is a very very small edit on my kermitSieve

    Contributing requirements

    • [x] I read the contribution guidelines in CONTRIBUTING.md.
    • [x] I placed my solution in the correct solution folder.
    • [x] I added a README.md with the right badge(s).
    • [x] I added a Dockerfile that builds and runs my solution.
    • [x] I selected drag-race as the target branch.
    • [x] All code herein is licensed compatible with BSD-3.
    opened by q3w3e3 0
  • Docker: run without seccomp (distorts benchmarks)

    Docker: run without seccomp (distorts benchmarks)

    Description

    Disables seccomp when running docker.

    For unknown reasons, running python under docker can be over 50% slower than native usage. This is a performance bug in docker, which has something to do with its use of seccomp. See https://pythonspeed.com/articles/docker-performance-overhead/ and the corresponding docker issue https://github.com/moby/moby/issues/41389

    The performance difference is clear - locally when running make DIRECTORY=PrimePython, on a linux system the performance of the ssovtest solution goes from 1998 passes to 4110. It seems seccomp doesn't affect the usage of the external numpy library or compiled languages, but you may see a speed boost for some other interpreted languages with this fix.

    Other considerations

    Should we disable seccomp if it's providing security? Well, if all code in this repo has been reviewed and verified, it should be absolutely fine (note all the containers are running as root user anyway, so we better hope this is the case).

    Contributing requirements

    • [x] I read the contribution guidelines in CONTRIBUTING.md.
    • [x] I placed my solution in the correct solution folder.
    • [x] I added a README.md with the right badge(s).
    • [x] I added a Dockerfile that builds and runs my solution.
    • [x] I selected drag-race as the target branch.
    • [x] All code herein is licensed compatible with BSD-3.
    opened by olliemath 0
  • Address review comments for PR #489

    Address review comments for PR #489

    This addresses the review comments in PlummersSoftwareLLC#489 (zero-initialization of the ArrayPool buffer, and switching to UInt32 elements). I've also removed some unnecessary variables.

    On my machine, these changes increase the number of passes from 2906 for the version currently in the main tree, to 6977 for this version.

    opened by rbergen 0
  • Introduction of Numba, granting python a 10% speed up when being compared to solution 3

    Introduction of Numba, granting python a 10% speed up when being compared to solution 3

    Description

    Implements Numba and Numpy effectively to give the sieve a 10% to 20% boost in performance over solution 3

    Contributing requirements

    • [x] I read the contribution guidelines in CONTRIBUTING.md.
    • [x] I placed my solution in the correct solution folder.
    • [x] I added a README.md with the right badge(s).
    • [x] I added a Dockerfile that builds and runs my solution.
    • [x] I selected drag-race as the target branch.
    • [x] All code herein is licensed compatible with BSD-3.
    opened by jestes15 0
  • Super fly Python style

    Super fly Python style

    Description

    This code has a very simple structure (46 rows, non object oriented). It uses two external libraries but has a working docker file. It is approx. 1.5 times faster than solution_3.

    Contributing requirements

    • [x] I read the contribution guidelines in CONTRIBUTING.md.
    • [x] I placed my solution in the correct solution folder.
    • [x] I added a README.md with the right badge(s).
    • [x] I added a Dockerfile that builds and runs my solution.
    • [x] I selected drag-race as the target branch.
    • [x] All code herein is licensed compatible with BSD-3.
    opened by jugge83 0
Owner
Former MSFT dev; I wrote Task Manager, Zip Folders, ported Space Cadet Pinball, worked on the Shell 93-03. Also added Product Activation to Windows :-)
null
Prime Number Projects in C#/C++/Python

Primes | A Software Drag Race Note: You're currently looking at the community contribution branch of this repo, which is now the default. The original

Plummer's Software LLC 2k Dec 28, 2022
Python Inference Script is a Python package that enables developers to author machine learning workflows in Python and deploy without Python.

Python Inference Script(PyIS) Python Inference Script is a Python package that enables developers to author machine learning workflows in Python and d

Microsoft 13 Nov 4, 2022
Using Visual Studio C++ to read IP addresses and comport number (Serial number) on Windows platform

Using Visual Studio C++ to read IP addresses on Windows platform

zhuhuijin 0 Feb 2, 2022
Kaprekar constant, number 6174, number 495.

Kaprekar Constant Demos Kaprekar constant, number 6174, number 495. This repository contains 1 Visual Studio solution, which managing 2 Visual Studio

MatrixLife 1 Dec 25, 2021
The music of Fibonacci and prime numbers

fibprimes "Main" branch contains source code and generated MIDI file. "MP3" branch contains the MP3 file converted from the MIDI file. General Each ch

null 25 Feb 4, 2022
🔥 A number of Flutter projects that cover slightly more complex topics.

Check out the YouTube videos to see the indepth process of each project! Reactive Grid https://youtu.be/OEtt_8_FU0s Fancy Full Screen Animation https:

Philip Vu 27 Dec 18, 2022
Sharpmake is an open-source C#-based solution for generating project definition files, such as Visual Studio projects and solutions, GNU makefiles, Xcode projects, etc.

Sharpmake Introduction Sharpmake is a generator for Visual Studio projects and solutions. It is similar to CMake and Premake, but it is designed for s

Ubisoft 779 Dec 23, 2022
BLLIP reranking parser (also known as Charniak-Johnson parser, Charniak parser, Brown reranking parser) See http://pypi.python.org/pypi/bllipparser/ for Python module.

BLLIP Reranking Parser Copyright Mark Johnson, Eugene Charniak, 24th November 2005 --- August 2006 We request acknowledgement in any publications that

Brown Laboratory for Linguistic Information Processing 218 Dec 17, 2022
A Binary Clock. Written 3 different ways. C and SDL, Python and PyGame, Python and PyGame Zero.

Super Clock A Binary Clock. Written 3 different ways. Python with PyGame Zero, Python with PyGame and C with SDL2. Time is displayed in 3 groups of 8

null 3 Dec 8, 2021
LibTomMath is a free open source portable number theoretic multiple-precision integer library written entirely in C.

libtommath This is the git repository for LibTomMath, a free open source portable number theoretic multiple-precision integer (MPI) library written en

libtom 543 Dec 27, 2022
Universal Number Arithmetic

Universal: a header-only C++ template library for universal number arithmetic The goal of the Universal Numbers Library is to offer applications alter

Stillwater Supercomputing, Inc. 296 Dec 23, 2022
A collection of single-file C libraries. (generic containers, random number generation, argument parsing and other functionalities)

cauldron A collection of single-file C libraries and tools with the goal to be portable and modifiable. Libraries library description arena-allocator.

Camel Coder 40 Dec 29, 2022
Number recognition with MNIST on Raspberry Pi Pico + TensorFlow Lite for Microcontrollers

About Number recognition with MNIST on Raspberry Pi Pico + TensorFlow Lite for Microcontrollers Device Raspberry Pi Pico LCDディスプレイ 2.8"240x320 SPI TFT

iwatake 51 Dec 16, 2022
Terminal calculator made for programmers working with multiple number representations, sizes, and overall close to the bits

Programmer calculator The programmer calculator is a simple terminal tool designed to give maximum efficiency and flexibility to the programmer workin

romes 183 Dec 24, 2022
A fast phone number lib for Ruby (binds to Google's C++ libphonenumber)

MiniPhone A Ruby gem which plugs directly into Google's native C++ libphonenumber for extremely fast and robust phone number parsing, validation, and

Ian Ker-Seymer 148 Dec 28, 2022
Simulation code for the specific PDP-10 serial number 32 at the Stanford A. I. Lab in 1974 as a solo processor with all the I/O devices simulated as on the PDP-10. Omit the co-processor PDP-6 sn16.

KA10 sn32 Synopsis This repository contains software and documentation for running the unique PDP-10 KA serial number 32 that was at Stanford in July

Saildart Archive 4 Aug 7, 2021
An embedded system for displaying current number of followers on bilibili. A reproduction of eInkBoard v1. 一个能显示哔哩哔哩账号实时粉丝数的嵌入式系统,eInkBoard v1 的复刻版。

eInkBoard v2 An embedded system for displaying current number of followers on bilibili. A reproduction of eInkBoard v1 (this page is in Chinese). 一个能显

Karbon Chen 4 Dec 6, 2021
FractalCrypt - Free cryptoarchiver permitting any number of hidden volumes for deniable encryption

FractalCrypt - Free cryptoarchiver permitting any number of hidden volumes for deniable encryption

Ivan Serov 360 Dec 12, 2022
Trident provides an easy way to pass the output of one command to any number of targets.

Trident: The multiple-pipe system Trident provides an easy way to pipe the output of one command to not just one but many targets. These targets can b

Matthias Gessinger 36 Nov 23, 2021