Andrewsville / PHP-Token-Reflection

Library emulating the PHP internal reflection using just the tokenized source code
http://andrewsville.github.com/PHP-Token-Reflection/
Other
190 stars 44 forks source link

Filesystem-based backend #47

Closed ondrejmirtes closed 6 years ago

ondrejmirtes commented 11 years ago

Backend that would not require huge memory_limit increase on big projects would be very nice.

I can prepare a pull request.

kukulich commented 11 years ago

Pull request would be nice!

ondrejmirtes commented 11 years ago

OK, I'll try to implement backend based on Nette\Caching\Cache.

Andrewsville commented 11 years ago

Well, pull request will not be so easy to prepare :) Or better said it depends on what exactly you want to store in the filesystem. It is really simple to store the tokenized source codes (token streams). That is possible right away. But it is impossible at the moment to store the reflections classes since they do not support serialization. The biggest problem is probably the fact that every reflections needs to know its Broker instance which means either to inject it after unserialization (no way) of make an own form or "serialization" (better but still pretty painful).

I have reopened #11 which will make this far easier.

ondrejmirtes commented 11 years ago

I still want to do it :) I will look into that in the nearest month.

ondrejmirtes commented 11 years ago

I tried to implement caching of the token streams and it's not worth a lot. The token streams still need to parsed every time, so we save some time only on the tokenizing part.

It saved only about 14 seconds (45 -> 31) on a large project.

Here's the implementation (really not considered to be merged :)): https://github.com/ondrejmirtes/PHP-Token-Reflection/tree/cached-backend

ondrejmirtes commented 6 years ago

No longer relevant