aic-sri-international / aic-expresso

SRI International's AIC Symbolic Manipulation and Evaluation Library (for Java 1.8+)
BSD 3-Clause "New" or "Revised" License
8 stars 0 forks source link

Improve performance of TreeUtil Search #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
TreeUtil search appears to slow due to dynamic tree extension: would it help to 
do it in memory before adding nodes to tree?

Original issue reported on code.google.com by ctjoreilly@gmail.com on 4 Jan 2014 at 12:42

GoogleCodeExporter commented 9 years ago
Hi Rodrigo,

All the nodes already exist as a tree in memory. There are two main reasons for 
it being slow:

1. On the first query, all the expression need to be converted to strings in 
order to do the matching against (the string representation of an Expression is 
lazily instantiated in order to save memory in most cases). If you watch your 
processes memory usage before you do a find a a big trace you will see a big 
jump in memory usage once you run the query due to all the strings being 
instantiated and cached (by the expressions, at this point for computation 
efficiency as its been deemed the string is wanted). On subsequent finds, if 
you add no more trace, you should find the response to be much faster.

2. Related to point 1 you need to ensure you have enough memory in order for 
the string representations of all of the expressions in a trace to be 
instantiated. When running belief queries I usually set:
-Xmx8g
when wanting to use the trace view.

Let me know what you think.

Original comment by ctjoreilly@gmail.com on 24 Jan 2014 at 10:55

GoogleCodeExporter commented 9 years ago
Ok, that makes sense, thanks.

Original comment by rodrigob...@gmail.com on 29 Jan 2014 at 11:19