Giter VIP home page Giter VIP logo

turbobase64's Introduction

Turbo Base64

PyPI AppVeyor

๐Ÿš€ Lightning fast base64 encoding for Python

โœจ Features

  • 20-30x faster than the standard library
  • Benchmarks faster than any other C base64 library
  • Fastest implementation of AVX, AVX2, and AVX512 base64 encoding
  • No other dependencies

โšก How fast is it?

Graph generated from benchmark.py:


๐Ÿ’ป Usage

>>> import turbob64

This will automatically detect the fastest algorithm your CPU is capable of and use it.

Encoding

>>> turbob64.b64encode(b'Hello World!')
b'SGVsbG8gV29ybGQh'

Decoding

>>> turbob64.b64decode(b'SGVsbG8gV29ybGQh')
b'Hello World!'

Other Functions

Directly call CPU-specific algorithms

Memory efficient (small lookup tables) scalar but slower version

turbob64.b64senc(b'Hello World!')
turbob64.b64sdec(b'SGVsbG8gV29ybGQh')

Fast scalar

turbob64.b64xenc(b'Hello World!')
turbo64.b64xdec(b'SGVsbG8gV29ybGQh')

ssse3 SIMD

turbob64.b64v128enc(b'Hello World!')
turbob64.b64v128dec(b'SGVsbG8gV29ybGQh')

avx SIMD

turbob64.b64v128aenc(b'Hello World!')
turbob64.b64v128adec(b'SGVsbG8gV29ybGQh')

avx2 SIMD

turbob64.b64v256enc(b'Hello World!')
turbob64.b64v256dec(b'SGVsbG8gV29ybGQh')

avx2 SIMD (optimized for short strings)

turbob64.b64v256enc_short(b'Hello World!')
turbob64.b64v256dec_short(b'SGVsbG8gV29ybGQh')

avx512_vbmi SIMD

turbob64.b64v512enc(b'Hello World!')
turbob64.b64v512dec(b'SGVsbG8gV29ybGQh')

turbobase64's People

Contributors

daijro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

shabbirhasan1

turbobase64's Issues

Can't build on debian bookworm python 3.12

sudo apt-get -y update && apt-get -y install build-essential
pip install turbob64
Collecting turbob64
  Downloading turbob64-1.1.1.tar.gz (46 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 46.3/46.3 kB 1.2 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: turbob64
  Building wheel for turbob64 (pyproject.toml): started
  Building wheel for turbob64 (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error

  ร— Building wheel for turbob64 (pyproject.toml) did not run successfully.
  โ”‚ exit code: 1
  โ•ฐโ”€> [24 lines of output]
      running bdist_wheel
      running build
      running build_py
      running build_ext
      /tmp/pip-build-env-xxlrkbzo/overlay/lib/python3.12/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /tmp/pip-install-ayvu3hwr/turbob64_afd9cfac43d9484a874a75c22b51ac52/src/turbob64.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      Compiling src/turbob64.pyx because it changed.
      [1/1] Cythonizing src/turbob64.pyx
      building 'turbob64' extension
      creating build
      creating build/temp.linux-x86_64-cpython-312
      creating build/temp.linux-x86_64-cpython-312/src
      gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/usr/local/include/python3.12 -c src/turbob64.c -o build/temp.linux-x86_64-cpython-312/src/turbob64.o /O3 /fp:fast /arch:AVX /arch:AVX2 /arch:AVX512
      gcc: warning: /O3: linker input file unused because linking not done
      gcc: error: /O3: linker input file not found: No such file or directory
      gcc: warning: /fp:fast: linker input file unused because linking not done
      gcc: error: /fp:fast: linker input file not found: No such file or directory
      gcc: warning: /arch:AVX: linker input file unused because linking not done
      gcc: error: /arch:AVX: linker input file not found: No such file or directory
      gcc: warning: /arch:AVX2: linker input file unused because linking not done
      gcc: error: /arch:AVX2: linker input file not found: No such file or directory
      gcc: warning: /arch:AVX512: linker input file unused because linking not done
      gcc: error: /arch:AVX512: linker input file not found: No such file or directory
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for turbob64
Failed to build turbob64
ERROR: Could not build wheels for turbob64, which is required to install pyproject.toml-based projects
The command '/bin/sh -c pip install turbob64' returned a non-zero code: 1

works on windows however.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.