-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Orm.cs
55 lines (42 loc) · 1.6 KB
/
Orm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System.Collections.Generic;
using System.Linq;
namespace Venflow.Score
{
public class Orm
{
public double BenchScore { get; private set; }
public double AllocScore { get; private set; }
public bool HasCurrentBench { get; private set; }
public (string Name, string Link) OrmName { get; }
private readonly List<double> _benchTimeScores;
private readonly List<double> _benchAllocScores;
public Orm((string Name, string Link) ormName)
{
OrmName = ormName;
_benchTimeScores = new List<double>();
_benchAllocScores = new List<double>();
}
public void AddBenchScore(double benchScore, double allocScore)
{
_benchTimeScores.Add(benchScore);
_benchAllocScores.Add(allocScore);
HasCurrentBench = true;
}
public void FinishBench(double lowestBenchScore, double lowestAllocScore)
{
if (_benchTimeScores.Count != 0 &&
!_benchTimeScores.Any(x => x == lowestBenchScore))
{
BenchScore += _benchTimeScores.Min() / lowestBenchScore - 1;
}
_benchTimeScores.Clear();
if (_benchAllocScores.Count != 0 &&
!_benchAllocScores.Any(x => x == lowestAllocScore))
{
AllocScore += (_benchAllocScores.Min() / lowestAllocScore - 1) / 10; // Divided, in order to lower the impact by memory usage on the final score.
}
_benchAllocScores.Clear();
HasCurrentBench = false;
}
}
}