blueconic / browscap-java

A blazingly fast and memory efficient (thread-safe) Java client on top of the BrowsCap CSV source files.
MIT License
194 stars 37 forks source link

Memory consuming #59

Closed jeans11 closed 1 year ago

jeans11 commented 1 year ago

Hi guys!

I load / create a browscap parser (create once and reuse it) but the load increase of 2G my service memory. Is all the Rule that are responsible of the huge memory gap?

Thanks

paulrutter commented 1 year ago

I haven't tested the exact memory usage lately, but this library is fast because it keeps all rules in memory in an efficiënt way. So that's indeed the instances of Rule.

marcio-absmartly commented 1 year ago

Sorry chime in after closed, but the primary issue is not the memory usage during operation, it's the memory usage and time spent during initialization building of these efficient structures. What we would need would be way to pre-compute this and ship it in the package, instead of building it every-time.

paulrutter commented 1 year ago

Ah right, i think that could be done by serializing the data structure to a file and deserialize on initialization. Not sure if that would perform better in terms of initial memory usage, but worth a try. PRs are welcome, i won't get to it.