Heteroclinic.net logo

www.heteroclinic.net

In Depth 3D Computer Graphics
Chapter 1 Mesh File XIII, Skip Regex for File Parsing -- Large Strings

201603

With an un-explained exception for parsing 'bunny.gts', we do two further tests. First, we just tried to concatenate a string with itself repeatedly. At some given point, the jvm stalls. We also tried to read some key health indicators of the jvm. Please note the readings may differ as per the initiall JVM settings.


This is a situation not easy to explain from the root and probably even more difficult to give a solution. But, what we observed is that if we concatenate large strings with the '+' operator, the process-ability of the StringBuilder module stressed out. This is the first situation we should try to avoid. It also shows the strings manipulation functions produce quite some by-products so the resources drained to an unkown sink.

In Depth 3D Computer Graphics
Chapter 1 Mesh File XIV, Skip Regex for File Parsing -- Split Large Strings

201603

Next, we try to gauge the size of the string we can split. Though such measure is not well defined, but we still see that the cost grows exponentially, at least it is non-linearly increasing, as the string size doubles. So far, using Regex to do file parsing seems to be off track.

In Depth 3D Computer Graphics
Chapter 1 Mesh File XVI, A Mesh Reader Using Line Reader

201603

In fact, if we are using BufferedReader, the program will process data "in memory" behind the scene.

In Depth 3D Computer Graphics
Chapter 1 Mesh File XVI, A Mesh Reader Using Line Reader -- Using Unit Test to Consolidate the Advancement

201603

We again add one more unit test to make sure future changes will not bring stall to the existing suite.