Skip to content

Conversation

@Geratoptus
Copy link

No description provided.

- Убрал ненужные классы
- В сравнении добавил каст к (double), теперь проверка корректная
- Добавил GC.Collect() перед замером времени для более корректной проверки

Enumerable.Range(1, results.Count - 1)
.Select(i => results[i].Ticks / results[i - 1].Ticks)
.Should().OnlyContain(timeRatio => timeRatio < scale * scale);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может будем сравнивать с меньшей асимптотичной сложностью?
O(n^2) выглядит много

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

… переданных параметров вынес в статические поля
{
var begin = 0;
var tokenList = new List<Token>();
var memoryText = new Memory<char>(text.ToCharArray());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://learn.microsoft.com/en-us/dotnet/api/system.memoryextensions.asmemory?view=net-9.0

Чтобы избежать аллокации дополнительных O(text) памяти

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants