Folleach / GeometryDashAPI

API for Geometry Dash
MIT License
62 stars 8 forks source link

Some Features/Fixes #28

Closed IRacle1 closed 10 months ago

IRacle1 commented 10 months ago

I also changed logic in typedescriptor, GetPropertiesAndFields, for old logic fields in inherited classes werent work properly, the logic in my pr works fine for that, but I still could be wrong

IRacle1 commented 10 months ago

All tests passed except for game resources, so alright

image
Folleach commented 10 months ago

Thank you for your contribution!
I'll check this in the nearest time

For now I've noticed that you've used the dev branch. This branch is outdated for 4 months. But! It's okay, I'll add your branch to the main one eventually.

Maybe I should write to contribution.md about which branches it's worth creating your own features from

Folleach commented 10 months ago

I've finished
If you don't have any questions, we can release this!

IRacle1 commented 10 months ago

I've finished If you don't have any questions, we can release this!

Yeah, tnx for your changes, now all looks great. i also changed linq expression by a usefull flag, should work faster

Folleach commented 10 months ago

i also changed linq expression by a usefull flag, should work faster

Oh, great!
I didn't notice this flag

You're right about performance, it's almost 2x faster!

Method Mean Error StdDev Median Gen0 Allocated
BindingFlag 69.17 ns 1.817 ns 5.330 ns 67.35 ns 0.0305 64 B
Linq 108.19 ns 2.207 ns 4.407 ns 106.65 ns 0.0421 88 B
class A
{
    protected int X;
}

class B : A
{
    protected int Y;
}

[MemoryDiagnoser]
public class GetFieldsBenchmarks
{
    private Consumer c = new Consumer();

    [Benchmark]
    public void BindingFlag()
    {
        typeof(B).GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly).Consume(c);
    }

    [Benchmark]
    public void Linq()
    {
        typeof(B).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).Where(x => x.DeclaringType == typeof(B)).Consume(c);
    }
}
Folleach commented 10 months ago

Released in v0.2.19