Giter Club home page Giter Club logo

comparison-multiplying-matrices's Introduction

Comparison between consecutive vs concurrent ways of multiplying matrices using standard method of matrix multiplication O(n^3).

To run the tests:

a-) run in the console this command: $ make full
b-) another way is to create a docker image and run it
    build it: make docker-build
    run it: make docker-run

These tests ran on my laptop in two ways (within a docker container and without docker)

different sizes of matrices were tested: 2x2, 10x10, 50x50, 100x100 and 2000x2000


Equipment characteristics

goos: linux
goarch: amd64
pkg: github.com/gonzalezlrjesus/multiply-matrices
cpu: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz

General results table

Docker Container

test-docker

Laptop

Test-laptop

Average amount of time each iteration took to complete (nanoseconds per operation)

Docker Container

amount-time-docker

Laptop

amount-time-laptop

Bytes were allocated per operation

Docker Container

bytes-operation-docker

Laptop

bytes-operation-laptop

Memory allocations occurred per operation

Docker Container

memory-operation-docker

Laptop

memory-operation-laptop

Total number of times the loop was executed

Docker Container

number-loops-docker

Laptop

number-loops-laptop

Analysis

  • When we work with a small amount of data it is good to use the consecutive form of multiplying because the amount of time to do the multiplication is shorter than the concurrent form, until a matrix of size less than 50 consecutive forms is the best option after of that size always better the option will be concurrency per row
  • The bytes or memory allocations per operation are so different between consecutive and concurrent forms, memory consumption is efficient by the consequitive but with a large matrix 2000 concurrency per row and consequitve become the same in different environments but concurrency per element is same only in Docker Container and running so different on my laptop
  • Go reduce the amount of time to run the loop when the size of the array grows
  • The worst way to do an matrix multiplication is by using the concurrency per element, it is the way in which it takes more time to complete the operation, more memory is used and more bytes are allocated.
  • The concurrency form takes more bytes and memory because it moves some items to the HEAP memory area
  • I used two environments to run my tests on docker container and on my laptop, both environments showed the amount of time to complete operations is similar, but something different happened with the bytes and the memory allocation had the same result in docker container
  • Reading data from a txt file, taking and storing in a temporary variable represents a considerable amount of memory used by variables, it is possible to use another way to get the data
  • I could use a different way of doing the multiplication, maybe using divide and conquer or channels etc.
  • Implementing concurrency is not always the best option for any array size, it depends on several factors such as the size of the array and how to implement concurrency is important

comparison-multiplying-matrices's People

Contributors

gonzalezlrjesus avatar

Stargazers

Roman avatar

Watchers

 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.