Giter Club home page Giter Club logo

cppcore's Introduction

Introduction

CppCore is my personal C++17 framework with focus on:

  • High Performance
  • Cross Platform Compatibility
  • Easy Integration (almost header-only)

It was made for my own use but I am happy to share it with everyone.

License

MIT License

Supported Platforms

Min. OS X64 X86 ARM64 ARM Github Action
Windows 10 🔴 Windows
Ubuntu 20.04 Linux
OSX 10.15 🔴 🔴 OSX
Android 21 Android
iOS 13.0 🔴 🔴 🔴 iOS

Design Principles

  1. Performance, Performance, Performance:
    The most important principle. This framework was design to be used in real-time critical applications such as games. If you find something that can be done faster, please let me know.
  2. Fixed-Size Memory Pooling:
    This framework avoids using malloc() and free() (respectively new and delete) to allocate memory at runtime in favor of a fully compile-time specified memory layout. Almost all memory is allocated on startup and used until shutdown - faster, predictable and no undefined out-of-memory behaviour. Yes, there are always exclusions.
  3. Virtual Function Pointers:
    OOB programming is great but its disadvantages are often forgotten. No, you won't find things like tiny vector classes blown up in size due to a VFPTR with horribly slow non-inlined arithmetic function calls in this library.
  4. Header-Only:
    Allows the compiler to efficiently inline all the framework code into your object files and therefore making integration much simpler and code executing faster. There are a few exclusions to this pattern due to platform limitations (e.g. Windows Message Processing Function)
  5. Multithreading:
    This framework comes with its own multithreading patterns and uses multiple cores whenever possible/useful.

How-To

  • CppCore is an almost header-only library. Just include the headers and build the CppCore.cpp with your project.
  • Only examples and test executables can be built from this repository (see Build Notes for them).

Implementations

Hashing

Header Bits Reference Notes
CRC32.h 32 CRC32/CRC32C (CPU)
Murmur3.h 32 Popular for hash tables
MD5.h 128 Wikipedia
SHA2.h 256/512 Wikipedia

Crypto

Header Reference Notes
AES.h Wikipedia 128/192/256 Bit | ECB/CBC/CTR | AES-NI
HMAC.h Wikipedia MD5 | SHA2-256 | SHA2-512
PBKDF2.h Wikipedia HMAC-SHA2-256 | HMAC-SHA2-512

Math

Header Notes
BigInt.h Large unsigned integers from uint128_t up to uint2048_t
Primes.h Prime Tests (Miller-Rabin/Lucas-Lehmer/...)
V2.h 2D Vector for float double int32_t int64_t with SSE/AVX
V3.h 3D Vector for float double int32_t int64_t with SSE/AVX
V4.h 4D Vector for float double int32_t int64_t with SSE/AVX

Containers

Algorithms

Header Complexity Notes
QuickSort.h O(n*log(n)) Non-Recursive Quicksort Algorithm
BinarySearch.h O(log(n)) Non-Recursive Binarysearch Algorithm

Basic

Different O(k) are used to outline some differences between operations with constant complexity on different containers.

Header Operation Complexity Notes
Array.h operator[]
pushFront()
pushBack()
popFront()
popBack()
insertAt()
removeAt()
O(1)
O(n)
O(1)
O(n)
O(1)
O(n)
O(n)
  • Simple Array
  • Sorted or Unsorted
  • Fastest operator[] pushBack() popBack()
BinTree.h
Queue.h operator[]
pushFront()
pushBack()
popFront()
popBack()
insertAt()
removeAt()
O(10)
O(10)
O(10)
O(10)
O(10)
O(n)
O(n)
  • Simple Queue
  • Sorted or Unsorted
  • Constant O(k) for pushFront() popFront()
  • Example: Message Queue
MinHeap.h operator[]
push()
pop()
removeAt()
O(1)
O(log(n))
O(log(n))
O(log(n))
  • Binary Min Heap
  • Always Sorted
  • Finds minimum at root in O(1)
  • Example: Timer Schedule
  • Example: A* Open-List
HashTable.h insert()
remove()
find()
O(1000)
O(1000)
O(1000)
  • Example: Large Lookup Dictionary
  • Example: Database Table
...

Advanced

Header Operation Complexity Notes
Cache.h

Threading

Header Notes
Runnable.h Wraps std::function executing a piece of code on a thread at a certain time.
Thread.h Uses std::thread
Schedule.h

Network

Header Notes
Socket.h
  • Basic POSIX Socket Wrapper Class
  • Works around remaining differences on platforms
TcpSocket.h
  • Builds upon Socket.h
  • TCP IPv6 Dual-Stack Socket
  • For Server and Client
  • Advanced connect(), listen() and accept() methods
TcpLink.h
  • Builds upon TcpSocket.h
  • Implements a raw TCP connection
  • For Server and Client
TcpClient.h
  • Builds upon TcpLink.h
  • For Client
TcpSession.h
  • Builds upon TcpLink.h
  • For Server
TcpServer.h
  • Builds upon TcpSession.h
  • For Server
...

UI

Header Notes
Input.h Keyboard/Mouse Input from Window-Events on Win/Linux/OSX
Window.h Windows Wrapper for Windows/Linux/OSX

Misc

Header Notes
Buffer.h Fixed Size Memory Buffer
Random.h Pseudo Random Number Generators
  • Xorshift32
  • Xorshift64
  • Xoshiro32
  • Xoshiro64
  • Mulberry32
  • Splitmix64
  • Cpu32*
  • Cpu64*
* with RDRAND
Uuid.h Universally Unique Identifier

Applications

Start type Console from terminal on OSX.

Examples

Name Type Folder Notes
CppCore.Example.Client Console Link Custom binary network protocol client
CppCore.Example.Server Console Link Custom binary network protocol server
CppCore.Example.UI Window Link Cross-Platform Application Window and Input

Others

Name Type Folder Notes
CppCore.Test Console | VS-Test Link Unit Tests
CppCore.Debug Console Link Empty project to run code during development

cppcore's People

Contributors

cyberjunk avatar

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.