Skip to content

bhmj/meant4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

meant4

What is it?

Sample factorial calculating task. Three versions.

v1 : calculate two factorials simultaniously in two goroutines.
v2 : calculate N factorials in one loop.
v3 : calculate N factorials in one loop with parallelism.

Results on [200000,300000] :
v1 : 10.90 seconds
v2 : 9.47 seconds
v3 : 1.38 seconds

Add "count": 1 parameter to get the number of bits in the result, not the actual numbers (see examples below).

Compiled and checked with go 1.17.

Building, testing and running

Run make all to build all three versions in ./build/.
Run make help to get more info.

Sample commands:

time curl --request POST --url http://localhost:8989/factorial --data '{"numbers": [200000, 300000]}' -o /dev/null

time curl --request POST --url http://localhost:8989/factorial --data '{"numbers": [200000, 300000], "count": 1}'

Releases

No releases published

Packages

No packages published