Skip to content

Commit 51b6593

Browse files
authored
Merge branch 'main' into patch-1
2 parents 6a18486 + adae263 commit 51b6593

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed

.github/workflows/bench.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,4 +355,7 @@ jobs:
355355
if: github.ref == 'refs/heads/main'
356356
env:
357357
VERCEL_PUBLISH_TOKEN: ${{ secrets.VERCEL_PUBLISH_TOKEN }}
358-
run: vercel website --prod --yes -t $VERCEL_PUBLISH_TOKEN || echo 'ignore errors'
358+
run: |
359+
npm i -g vercel
360+
vercel --version
361+
vercel website --prod --yes -t $VERCEL_PUBLISH_TOKEN || echo 'ignore errors'

.github/workflows/site.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
- uses: pnpm/action-setup@v2
2424
with:
2525
version: 9
26+
- run: npm i -g vercel
2627
- run: vercel --version
2728
- name: Build
2829
run: |

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ _Once a change is merged into main branch, the CI job will re-generate and publi
1919

2020
## Main Goals
2121

22-
- Compare performance differences between different languages. Note that implementations might be using different optimizations, e.g. with or w/o multithreading, please do read the source code to check if it's a fair comparision or not.
22+
- Compare performance differences between different languages. Note that implementations might be using different optimizations, e.g. with or w/o multithreading, please do read the source code to check if it's a fair comparison or not.
2323
- Compare performance differences between different compilers or runtimes of the same language with the same source code.
2424
- Facilitate benchmarking on real server environments as nowadays more and more applications are deployed with docker/k8s. It's likely to get a very different result from what you get on your dev machine.
2525
- A reference for CI setup / Dev environment setup / package management setup for different languages. Refer to [Github action](https://github.com/hanabi1224/Programming-Language-Benchmarks/blob/main/.github/workflows/bench.yml)
2626
- It focuses more on new programming languages, classic
27-
programming languages that are covered by [CLBG](https://benchmarksgame-team.pages.debian.net/benchmarksgame/index.html) receive limited or no maintainence, based on their popularity.
27+
programming languages that are covered by [CLBG](https://benchmarksgame-team.pages.debian.net/benchmarksgame/index.html) receive limited or no maintenance, based on their popularity.
2828

2929
# [Website](https://programming-language-benchmarks.vercel.app/)
3030

@@ -67,7 +67,7 @@ _Current benchmarks problems and their implementations are from [The Computer La
6767

6868
## Build
6969

70-
_The 1st step is to build source code from various of lanuages_
70+
_The 1st step is to build source code from various of languages_
7171

7272
```bash
7373
cd bench
@@ -123,16 +123,16 @@ Options:
123123
--force-rebuild A flag that indicates whether to force rebuild [default: False]
124124
--fail-fast A Flag that indicates whether to fail fast when error occurs [default: False]
125125
--build-pool A flag that indicates whether builds that can run in parallel [default: False]
126-
--verbose A Flag that indicates whether to print verbose infomation [default: False]
126+
--verbose A Flag that indicates whether to print verbose information [default: False]
127127
--no-docker A Flag that forces disabling docker [default: False]
128-
--langs <langs> Languages to incldue, e.g. --langs go csharp [default: ]
129-
--problems <problems> Problems to incldue, e.g. --problems binarytrees nbody [default: ]
130-
--environments <environments> OS environments to incldue, e.g. --environments linux windows [default: ]
128+
--langs <langs> Languages to include, e.g. --langs go csharp [default: ]
129+
--problems <problems> Problems to include, e.g. --problems binarytrees nbody [default: ]
130+
--environments <environments> OS environments to include, e.g. --environments linux windows [default: ]
131131
--version Show version information
132132
-?, -h, --help Show help and usage information
133133
```
134134

135-
## Referesh website
135+
## Refresh website
136136

137137
_Lastly you can re-generate website with latest benchmark numbers_
138138

@@ -146,9 +146,9 @@ serve dist
146146

147147
# TODOs
148148

149-
Intergrate test environment info into website
149+
Integrate test environment info into website
150150

151-
Intergrate build / test / benchmark infomation into website
151+
Integrate build / test / benchmark information into website
152152

153153
...
154154

bench/algorithm/edigits/1.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
class DigitsOfE
55
{
6+
private static readonly double LogOfTau = Math.Log(Math.Tau);
7+
private static readonly double LogOfTen = Math.Log(10);
8+
69
public static void Main(string[] args)
710
{
811
int n;
@@ -45,7 +48,7 @@ public static void Main(string[] args)
4548
{
4649
if (b == a + 1)
4750
{
48-
return (new BigInteger(1), new BigInteger(b));
51+
return (BigInteger.One, new BigInteger(b));
4952
}
5053
var mid = (a + b) / 2;
5154
var (pLeft, qLeft) = SumTerms(a, mid);
@@ -79,12 +82,12 @@ static int BinarySearch(int n)
7982

8083
static bool TestK(int n, int k)
8184
{
82-
if (k < 0)
85+
if (k <= 0)
8386
{
8487
return false;
8588
}
86-
var lnKFactorial = k * (Math.Log((double)k) - 1) + 0.5 * Math.Log(Math.PI * 2);
87-
var log10KFactorial = lnKFactorial / Math.Log(10);
89+
var lnKFactorial = k * (Math.Log((double)k) - 1) + 0.5 * LogOfTau;
90+
var log10KFactorial = lnKFactorial / LogOfTen;
8891
return log10KFactorial >= (double)(n + 50);
8992
}
9093
}

0 commit comments

Comments
 (0)