DataObjects-NET / dataobjects-net

https://dataobjects.net
MIT License
60 stars 23 forks source link

Save 8/4 bytes per node instance. Use is operator instead of bool field #302

Closed SergeiPavlov closed 10 months ago

SergeiPavlov commented 1 year ago

Potentially is saves megabytes

image

alex-kulakov commented 11 months ago

It is 29% slower operation, according to my benchmark runs. You hurt performance for memory. Do you struggle for memory that much?

SergeiPavlov commented 11 months ago

It is 29% slower operation, according to my benchmark runs.

Does this measuremetn include GC-time? My experience says that GC is one of main factors of performances. So I have a bias to save more memory at the cost of CPU cycles

alex-kulakov commented 10 months ago

Does this measuremetn include GC-time?

No, it doesn't, I wanted to know what is pure operations cost.

So I have a bias to save more memory at the cost of CPU cycles.

Not always, we know it :)

OK, lets not have the field.

Since a Node is created less frequent than checked for its TextNodeness during conversion to command text :) I wanted to cache this info to improve translation because it happens a lot of times for cached queries, it reduces translation overhead for a bit for the cost of size of this field. This was my thoughts, to me faster queries are important, little bit here, little bit there and we have some significant value :)

If this is ok for you highly loaded app then I agree.