GithubHelp home page GithubHelp logo

oop-to-dop's Introduction

Object Oriented Programming to Data Oriented Programming

Description

After seeing many talks on Data Oriented Programming but few examples on how to actually get started with it I decided to make this repo. The goal is to provide easy to digest examples in OOP as well as DOP.

Running

Go

   cd go
Tests
   go test ./...
Benchmarks
  go test ./... -bench=. -benchmem

Rust

 cd rust

Tests

 cargo test

Benchmarks

 cargo bench

Benchmarks

Rust

Function Name OOP Time (µs or ns) DOP Time (µs or ns) Speed Difference
find_by_id 4.2601 µs 35.571 ns DOP is 8.35x faster
find_by_title 91.119 ns 77.583 ns DOP is 1.17x faster
find_by_author_name 38.961 µs 40.111 µs OOP is 1.03x faster
update 62.089 ns 77.203 ns OOP is 1.24x faster
publish 40.402 ns 22.747 ns DOP is 1.78x faster
delete 726.47 µs 20.470 ns DOP is 35.49x faster
add 163.68 ns 465.10 ns OOP is 2.84x faster

Go

Function Name OOP Time (µs or ns) DOP Time (µs or ns) Speed Difference
FindPostById 34.672 µs 8.427 µs DOP is 4.11x faster
FindPostByTitle 17.51 ns 5.517 ns DOP is 3.17x faster
FindPostByAuthorName 61.521 µs 282.1 ns DOP is 4.59x faster
PublishPost 420.491 µs 7.466 ns DOP is 56.32x faster
UpdatePost 7726.18 µs 42.84 ns DOP is 180.35x faster
AddPost 848.7 ns 639.6 ns DOP is 1.33x faster
DeletePost 27815.649 µs 4830.309 µs DOP is 5.76x faster

TODO

  • Go Examples
  • Rust Examples
  • Zig Examples
  • C++ Examples
  • Others (Kotlin, Typescript, Java, C#)?
  • Real-World Examples in each language (Web Server, CLI, etc possibly)

oop-to-dop's People

Contributors

claytoncasey01 avatar

Stargazers

Mowazzem avatar  avatar

Watchers

James Cloos avatar  avatar

oop-to-dop's Issues

Add Concurrent Versions

It would be cool to have a concurrent version of each function, along with benchmarks, for both oop and dod.

Add Delete to Go

Want to have full CRUD capabilities for both OOP and DOP sides along with benchmarks to go with that.

Rust Optimizations

Rust DOD can still be optimized further, changes were made to the Posts but things can also be done to Author to improve over all performance even more.

Benchmark Config

Add a config file for benchmarks so that each set of benchmarks across all languages use the same values vs manually hard coding the values in per bench.

Go Add Unit Tests

Need to ensure the output is what I expect, so need to write unit tests for each function of the Dop and Oop packages.

Github Actions

Setup github actions to at least run tests before allowing a PR merge.

Zig Implementation

Add an implementation in Zig to match the Go and Rust implementations

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.