{"id":21159132,"url":"https://github.com/freakwill/benchmarks","last_synced_at":"2025-12-30T19:44:34.019Z","repository":{"id":43902011,"uuid":"164197278","full_name":"Freakwill/benchmarks","owner":"Freakwill","description":"benchmarks","archived":false,"fork":false,"pushed_at":"2022-08-10T12:38:32.000Z","size":1036,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-21T09:12:04.672Z","etag":null,"topics":["benchmarks","coffeescrpt","crystal","go","haskell","java","javascript","julia","lua","moonscript","python","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Freakwill.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-05T08:41:09.000Z","updated_at":"2022-06-26T12:14:32.000Z","dependencies_parsed_at":"2022-09-13T05:52:04.780Z","dependency_job_id":null,"html_url":"https://github.com/Freakwill/benchmarks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freakwill%2Fbenchmarks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freakwill%2Fbenchmarks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freakwill%2Fbenchmarks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freakwill%2Fbenchmarks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Freakwill","download_url":"https://codeload.github.com/Freakwill/benchmarks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243602304,"owners_count":20317607,"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":["benchmarks","coffeescrpt","crystal","go","haskell","java","javascript","julia","lua","moonscript","python","ruby"],"created_at":"2024-11-20T12:59:40.157Z","updated_at":"2025-10-29T22:36:57.001Z","avatar_url":"https://github.com/Freakwill.png","language":"Go","readme":"# Benchmarks\n\n## Introduction\n\nOne of my friends told me at least three times that Java is the greatest computer language currently. It is fast and safe. He care about the performance of the languages very much. I think the speed of a language is indeed nonnegligible. I try to learn a new language that is fast enough and has a user-friendly grammar.\n\n## primes\n\n### Algorithm (Sieve of Eratosthenes)\n\nRemark: Should contain step I and step II\n\n```python\n# Algorithm\n\ndef primes(n):\n    # sieve of Eratosthenes\n    # if not optimized, it will cost about 3 sec\n    \n    # step I\n    f = np.zeros(n+1)\n    f[0::2] = 1\n    i = 3\n    nn = np.sqrt(n)\n    while i \u003c= nn:\n        if f[i] == 0:\n            j = i*i\n            while j \u003c= n:\n                f[j] = 1\n                j += i * 2  #i.e. j=i(i+2) not j += i, since 2|i(i+1)\n        i += 2\n\n    # step II\n    P = [2] + [x for x in range(3, n+1, 2) if f[x] == 0]\n \n    return P\n```\n\n\n\n### Results(/s)\n\n| Python(numba)3.6/3.7  | Ruby/Crystal(release) | Lua/MoonScript | Julia | Java(compiled) | Haskell | Go(compiled) | JS/CoffeeScript |Nim |\n| --------------------- | --------------------- | -------------- | ----- | -------------- | ------- | ------------ | --------------- | ---|\n| ~0.9(0.75)/~0.88(0.6) | ~1.79/~0.45(0.1)      | ~2.77/~1.5     | ~0.25 | ~0.17(0.15)    | ?       | ~180µs(195)  | ~.35/~0.4       | ~0.037 |\n\n\n\nTo my surprise, Ruby is faster than Python (without numpy)! :astonished: Julia is really fucking rapid, even faster than Python with numba. It is fastest among interpreting languages. I tried my best to implement the algorithm in Java, but failed :cry:. I do not think I would learn Java currently, or C-family, their grammar is overstaffed and not user-friendly. I also do not master Haskell but I would persist in learning it. The grammar of Julia is similar to Matlab, but with many new concept that scares me.\n\n\n\nI implemented the algorithm with Go, it perfume unbelievable well!😲 😲 😲 \n\n\n\nMoonScript! Come on! You are excellent.\n\n\n\nCoffeeScript is great! So is JS.\n\nNim is also fast enough.\n\n---\n\n  Name：\tMacBook Pro\n\n  Iden：\tMacBookPro12,1\n\n  CPU：\tIntel Core i5\n\n  speed：\t2.7 GHz\n\n  number：\t1\n\n  number of cores：\t2\n\n  L2 cache（per core）：\t256 KB\n\n  L3 cache：\t3 MB\n\n  memory：\t8 GB\n\n  Boot ROM version：\tMBP121.0171.B00\n\n  SMC version（system）：\t2.28f7\n\n  seq No（system）：\tC02S27C5FVH5\n\n  hardware UUID：\t863AEEE2-6147-55E7-A37D-604FC48C662B","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreakwill%2Fbenchmarks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreakwill%2Fbenchmarks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreakwill%2Fbenchmarks/lists"}