Skip to content
/ O-Ring Public
forked from meox/O-Ring

Ring Erlang exercize implemented in several languages

Notifications You must be signed in to change notification settings

alvises/O-Ring

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

O-Ring

Ring Erlang exercise implemented in several languages.

Exercise

Taken from "Programming Erlang", second edition (by Joe Armstrong):

Write a ring benchmark. Create N processes in a ring. Send a message
round the ring M times so that a total of N * M messages get sent. Time
how long this takes for different values of N and M.
Write a similar program in some other programming language you are
familiar with. Compare the results. Write a blog, and publish the results
on the Internet!

Guidelines

To partecipate to the benchmark, you must adopt on the following guidelines:

  • every implementation shall expose an executable file (bash script or program) named ring
  • every implementation shall agree on the following API when ring is invoked: ./ring NumberOfNodes NumberOfTrips where:
    • NumberOfNodes: the number of processes/threads/nodes in the ring, N in the description above
    • NumberOfTrips: the number of times a message is passed in the ring, M in the description above
    • returned value of the script should be 0 if ok
    • in case of errors, nothing shall be written on stdout (you can write on stderr), and error code shall be different than 0
  • every implementation shall measure the time interval T0 used to setup the ring
  • every implementation shall measure the time interval T1 in milliseconds between the instant the first message is sent and the instant the last one is received
  • every implementation shall write to stdout a single number, T, described above
  • every implementation shall be provided in a separated folder with a significant name
  • every implementation shall provide a README.md file with (at least) the following sections:
    • Build: instructions on how to build; after a successful build, a ring executable should be present in a build directory
    • Description: a brief description of the implementation
  • every implementation has complete freedom on all other aspects not specified above

Example Output

> ./ring 200000 30
465 2990 200000 30

where:

  • 465 is the time in ms to setup the ring
  • 2990 is the time in ms from the first message to the last one
  • 200000 is the number of nodes in the ring
  • 30 is the number of trips (how many times we sent a message in the ring)

Erlang

  • Build
cd erling
erlc ring.erl
  • Run
./ring 200000 30

Elixir

  • Build
cd exring
mix escript.build
  • Run
./exring 200000 30

Go

  • Build
cd goring
make all
  • Run
./ring 200000 30

Haskell

  • Build
cd haskring
make all
  • Run
./ring 200000 30

Scala

Benchmark

Authors

  • Federico Bertolucci
  • Gian Lorenzo Meocci (glmeocci @ gmail.com)
  • Nicola Bonelli (nicola.bonelli @ gmail.com)
  • Alfredo Di Napoli

About

Ring Erlang exercize implemented in several languages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 30.6%
  • Elixir 26.7%
  • Pony 15.1%
  • Erlang 14.7%
  • Go 8.4%
  • Makefile 3.9%
  • Shell 0.6%