Это нехорошо, некрасиво, неправильно.
Если на таком сервере будет лежать чей-нибудь трек, защищённый авторскими правами, буду ли я как владелец замешан в нарушении ап?
Но если, как я писал выше, трек будет спрятан от глаз долой, но теоретически лежать в общем доступе, но только для тех, кому известно его название, будет ли нарушение?
Я проверил на 10 млн объектов и получилось что foo is null в 20 раз быстрее чем foo == null. Поэтому и интересно какой способ самый быстрый.
public class Benchmark
{
private static readonly object? Obj = new();
[Benchmark]
public bool EqualityOperator() => Obj == null;
[Benchmark]
public bool PatternMatching() => Obj is null;
[Benchmark] public bool ComplexPatterMatching() => Obj is not { };
[Benchmark] public bool ConstantReturn() => false;
[Benchmark] public bool EqualsCall() => Obj!.Equals(null);
[Benchmark] public bool ReferenceEqualsCall() => ReferenceEquals(Obj, null);
}
.method public hidebysig instance bool
EqualityOperator() cil managed
{
.custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.BenchmarkAttribute::.ctor()
= (01 00 00 00 )
.maxstack 8
// [10 39 - 10 50]
IL_0000: ldsfld object Benchmark::Obj
IL_0005: ldnull
IL_0006: ceq
IL_0008: ret
} // end of method Benchmark::EqualityOperator
.method public hidebysig instance bool
PatternMatching() cil managed
{
.custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.BenchmarkAttribute::.ctor()
= (01 00 00 00 )
.maxstack 8
// [12 38 - 12 49]
IL_0000: ldsfld object Benchmark::Obj
IL_0005: ldnull
IL_0006: ceq
IL_0008: ret
} // end of method Benchmark::PatternMatching
.method public hidebysig instance bool
ComplexPatterMatching() cil managed
{
.custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.BenchmarkAttribute::.ctor()
= (01 00 00 00 )
.maxstack 8
// [13 56 - 13 70]
IL_0000: ldsfld object Benchmark::Obj
IL_0005: ldnull
IL_0006: cgt.un
IL_0008: ldc.i4.0
IL_0009: ceq
IL_000b: ret
} // end of method Benchmark::ComplexPatterMatching
.method public hidebysig instance bool
EqualsCall() cil managed
{
.custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.BenchmarkAttribute::.ctor()
= (01 00 00 00 )
.maxstack 8
// [15 45 - 15 62]
IL_0000: ldsfld object Benchmark::Obj
IL_0005: ldnull
IL_0006: callvirt instance bool [System.Runtime]System.Object::Equals(object)
IL_000b: ret
} // end of method Benchmark::EqualsCall
.method public hidebysig instance bool
ReferenceEqualsCall() cil managed
{
.custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.BenchmarkAttribute::.ctor()
= (01 00 00 00 )
.maxstack 8
// [16 54 - 16 80]
IL_0000: ldsfld object Benchmark::Obj
IL_0005: ldnull
IL_0006: ceq
IL_0008: ret
} // end of method Benchmark::ReferenceEqualsCall
| Method | Mean | Error | StdDev | Median |
|---------------------- |----------:|----------:|----------:|----------:|
| EqualityOperator | 0.0000 ns | 0.0000 ns | 0.0000 ns | 0.0000 ns |
| PatternMatching | 0.0300 ns | 0.0164 ns | 0.0145 ns | 0.0271 ns |
| ComplexPatterMatching | 0.0401 ns | 0.0327 ns | 0.0376 ns | 0.0267 ns |
| ConstantReturn | 0.0000 ns | 0.0000 ns | 0.0000 ns | 0.0000 ns |
| EqualsCall | 1.3787 ns | 0.0437 ns | 0.0409 ns | 1.3770 ns |
| ReferenceEqualsCall | 0.0000 ns | 0.0000 ns | 0.0000 ns | 0.0000 ns |
| Method | Mean | Error | StdDev |
|---------------------- |----------:|----------:|----------:|
| EqualityOperator | 2.5751 ns | 0.0062 ns | 0.0049 ns |
| PatternMatching | 2.5682 ns | 0.0073 ns | 0.0065 ns |
| ComplexPatterMatching | 2.6456 ns | 0.0744 ns | 0.0696 ns |
| ConstantReturn | 0.0065 ns | 0.0044 ns | 0.0035 ns |
| EqualsCall | 4.6958 ns | 0.0337 ns | 0.0282 ns |
| ReferenceEqualsCall | 2.9525 ns | 0.0667 ns | 0.0557 ns |
const fetch = require("node-fetch");
async function gen() {
await fetch("https://www.reddit.com/r/memes/hot/.json?count=100")
.then(res => res.json())
.then(json => {
let postID =
json.data.children[
Math.floor(Math.random() * json.data.children.length)
];
result = {
image: postID.data.url,
category: postID.data.link_flair_text,
caption: postID.data.title,
permalink: postID.data.permalink
};
});
return result;
};
console.log(gen())
const fetch = require("node-fetch");
async function gen() {
const response = await fetch("https://www.reddit.com/r/memes/hot/.json?count=100");
const json = await response.json();
const post = json.data.children[Math.floor(Math.random() * json.data.children.length)];
return {
image: post.data.url,
category: post.data.link_flair_text,
caption: post.data.title,
permalink: post.data.permalink
};
}
gen().then(x=>console.log(x));
Также мечтаю после получения образования, пойти на обучение в другую страну.
И мне этот же самый фронтэндер выдал такую инфу, что этот kit платный.
а как тестировать крупные приложения?
Как понять, что именно мне нужно покрыть тестами?
Ведь по логике нужный каждый кусок покрывать, чтобы быть на 100% уверенным в этом коде?
Могу ли я использовать свой опыт C# .NETFramework 4.8 в остальных реализациях?
В интернете есть 3 версии языка программирования
Как например реализуются системы стриминга? (Тот же Parsec и GFN)
When you integrate the MAS SDK, you import its SDK library file into your project so you can use its functions.
Integrating the MAS SDK into your mobile app project gives you access to MAS’ fully managed monetization solution. This solution taps into multiple ad mediation platforms, and selects the one best suited for your game. Monetizing through high quality ad networks that serve in-app ads follows.
You need to integrate the MAS SDK before you can start monetizing your app.
Как быть ? чё делать ?
Нужно ли явно реализовывать логику уничтожения объекта?