Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Liip Serializer to the official serializer benchmark application #8

Open
tsantos84 opened this issue Feb 14, 2019 · 5 comments
Open

Comments

@tsantos84
Copy link

Hello,

Could you please add this library to the official serializer benchmark application?

https://github.com/php-serializers/ivory-serializer-benchmark

So we can compare its performance with others libraries.

@dbu
Copy link
Member

dbu commented Feb 14, 2019

great idea! we need to fix some bugs that crept into this version but once it works fine, it would be very interesting to see how it compares. if the models are reasonably small, there might not be much difference - the main benefit is on huge model structures.

@dbu
Copy link
Member

dbu commented Feb 28, 2019

i looked into this, but the problem we have is that as we generate explicit code, we do not handle recursions in models. the categories of the benchmark are a recursive model.

@tsantos84
Copy link
Author

tsantos84 commented Feb 28, 2019 via email

@dbu
Copy link
Member

dbu commented Mar 1, 2019

the way the code is currently generated, we unroll recursions and require to configure to stop them. see https://github.com/liip/metadata-parser/blob/87c9be0fc337fdf239ac5c97d87b8caff7bba74f/src/RecursionChecker.php#L100-L104

we developped this for a use case that did not have real recursion (there is sometimes one level of nesting, which is what the serialzer and metadata parser now can handle).

i can totally see that it would be nice to support unknown levels of recursion. we would need to track the recursion when building the metadata, and a different handling in the code generator so that it handles recursions on deserialize and also on serialize, plus detects endless loops in serialize. i'd want to keep the current option of unrolling a known maximum recursion depth for optimal performance. if somebody wants to add support for actual recursion, i am happy to review it, but i don't have the time to develop it myself.

@dbu
Copy link
Member

dbu commented Mar 1, 2019

to be more explicit about the performance: in our use case, the model tree has 1000s of objects (long lists of reasonably complex objects). even just calling a function for every object would lead to 50k or more function calls, which has a significant cost according to the code analyzer we ran.

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

No branches or pull requests

2 participants