{"id":23843871,"url":"https://github.com/oppodelldog/bigo","last_synced_at":"2025-06-16T09:04:18.410Z","repository":{"id":57497229,"uuid":"210129724","full_name":"Oppodelldog/bigo","owner":"Oppodelldog","description":"bigo time complexity","archived":false,"fork":false,"pushed_at":"2023-04-01T12:23:32.000Z","size":592,"stargazers_count":31,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T08:52:01.116Z","etag":null,"topics":["big-o","doesitscale","go","golang-library","load-testing","microframework","time-complexity"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Oppodelldog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-22T10:36:19.000Z","updated_at":"2024-08-11T11:37:48.000Z","dependencies_parsed_at":"2024-06-20T05:55:30.893Z","dependency_job_id":"7e438bc5-e750-4535-9c0e-4d540f91374d","html_url":"https://github.com/Oppodelldog/bigo","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/Oppodelldog/bigo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oppodelldog%2Fbigo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oppodelldog%2Fbigo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oppodelldog%2Fbigo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oppodelldog%2Fbigo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Oppodelldog","download_url":"https://codeload.github.com/Oppodelldog/bigo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oppodelldog%2Fbigo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260130998,"owners_count":22963432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["big-o","doesitscale","go","golang-library","load-testing","microframework","time-complexity"],"created_at":"2025-01-02T19:51:27.381Z","updated_at":"2025-06-16T09:04:18.385Z","avatar_url":"https://github.com/Oppodelldog.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Big-O Run \u0026 Plot\n\u003e Library that helps to run Big-O Experiments and plot the output\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/Oppodelldog/bigo)](https://goreportcard.com/report/github.com/Oppodelldog/bigo)\n[![godoc](https://img.shields.io/badge/godoc-reference-5272B4.svg)](https://godoc.org/github.com/Oppodelldog/bigo)\n[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://raw.githubusercontent.com/Oppodelldog/bigo/master/LICENSE)\n\n## Example comparing two variants\n[examples/ex1/main.go](examples/ex1/main.go)\n```go\npackage main\n\nimport (\n\t\"time\"\n\n\t\"github.com/Oppodelldog/bigo\"\n)\n\nfunc main() {\n\tfor testName, testRunner := range map[string]Runner{\n\t\t\"VariantA\": {Sleep: 100},\n\t\t\"VariantB\": {Sleep: 200},\n\t} {\n\t\tbigo.\n\t\t\tNew(\n\t\t\t\ttestName,\n\t\t\t\ttestRunner,\n\t\t\t\tbigo.NewArrayStepper([]float64{1, 2, 3}),\n\t\t\t).\n\t\t\tRun().\n\t\t\tWriteResultsToJson().\n\t\t\tPlotResults()\n\t}\n}\n\n// Runner implements TestRunner\ntype Runner struct {\n\tSleep int\n}\n\n// Step simulated to test some logic. For simplicity it simply waits N*r.Sleep milliseconds.\nfunc (r Runner) Step(n float64) bigo.OMeasures {\n\ttimeStart := time.Now()\n\n\t// TODO: put your code under test here\n\ttime.Sleep(time.Millisecond * time.Duration(r.Sleep) * time.Duration(n))\n\n\treturn bigo.OMeasures{{O: float64(time.Since(timeStart).Milliseconds())}}\n}\n```\n\nVariant A           |  Variant B\n:-------------------------:|:-------------------------:\n![](examples/ex1/VariantA.png)  |  ![](examples/ex1/VariantB.png)\n\n## Example extended capturing, N-2d\nLet's assume you want to test every N with another subset of test values.  \nFor example **N** would represent the number of Records in your database.  \nNow you want to test how your algorithm reacts on different user inputs.  \nThis is why **Step** returns a list of measures **bigo.OMeasures**.  \nThis allows to capture multiple Os for every **N**.    \nThe plot the will reflect that in **min, max, mean, all**  \n\n**Here's a sample**\n[examples/ex2/main.go](examples/ex2/main.go)\n\n ```go\n// Step simulated 3 additional scales to the given N. In this case\nfunc (r Runner) Step(n float64) bigo.OMeasures {\n\tvar measures bigo.OMeasures\n\tfor i := 1; i \u003c= 3; i++ {\n\t\ttimeStart := time.Now()\n\t\ttime.Sleep(time.Millisecond * time.Duration(r.Sleep) * time.Duration(n) * time.Duration(i*r.Factor))\n\t\tmeasures = append(measures, bigo.OMeasure{O: float64(time.Since(timeStart).Milliseconds())})\n\t}\n\n\treturn measures\n}\n\n ```\n \n Variant A           |  Variant B\n:-------------------------:|:-------------------------:\n![](examples/ex2/VariantA.png)  |  ![](examples/ex2/VariantB.png)\n\n\n## Example combining multiple Results in one plot\n\nTo combine mutliple capture results in one plot you have to collect\nthe Results into a **bigo.PlotSeriesList**, which then can be passed\nto **bigo.PlotTestResults** to generate one plot file.\n\n**Here's a sample**\n[examples/ex3/main.go](examples/ex3/main.go)\n\n ```go\nfunc main() {\n\tseriesList := bigo.PlotSeriesList{}\n\tfor testName, testRunner := range map[string]Runner{\n\t\t\"VariantA\": {Sleep: 100, Factor: 1},\n\t\t\"VariantB\": {Sleep: 200, Factor: 2},\n\t} {\n\t\tseriesList = append(seriesList, bigo.PlotSeries{Name: testName, Results: bigo.\n\t\t\tNew(\n\t\t\t\ttestName,\n\t\t\t\ttestRunner,\n\t\t\t\tbigo.NewArrayStepper([]float64{1, 2, 3}),\n\t\t\t).\n\t\t\tRun().GetResults(),\n\t\t})\n\t}\n\n\t// plot the collected result data and create one plot out of the data\n\tbigo.PlotTestResults(\"A/B\", seriesList)\n}\n ```\n \n Combined Plot          | \n:-------------------------:|\n![](examples/ex3/AB.png)|","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foppodelldog%2Fbigo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foppodelldog%2Fbigo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foppodelldog%2Fbigo/lists"}