Closed w4454962 closed 1 year ago
@w4454962, thanks for the feedback and sorry to hear that your machine got frozen caused by this library. Packrat can work on certain type of PEG grammar effectively, but not for all. This is not only a problem with cpp-httplib, but I think any other Packrat parsers have the same issue as well...
Originally, the "peg" algorithm runs at an exponential speed. In order to pursue linear speed, packrat uses an exponential memory space, that is, the number of rules * the length of input characters. When the input files are huge, for example, 30 mb files with 100 rules require 3 gb of memory space in theory. With such a large amount of memory, the amount of computation consumed by memory management alone exceeds that of pure deep search, Packrat is not a very rational solution
I just tried to input a 28mb file and let my computer's memory eat up. Then I got stuck directly. I forced the computer to restart to recover.....