pillar-markup / pillar

Markup syntax and associated tools to write and generate documentation, books and slides
MIT License
51 stars 37 forks source link

Use PetitParser compilation feature #83

Open DamienCassou opened 9 years ago

DamienCassou commented 9 years ago

This should significantly speed up parsing: https://bitbucket.org/janvrany/stx-goodies-petitparser/wiki/Home

DamienCassou commented 9 years ago

I've just tried. Here is my report:

DamienCassou commented 9 years ago

To load PetitCompiler:

Gofer new
  smalltalkhubUser: 'JanKurs' project: 'PetitParser';
  configurationOf: #PetitCompiler;
  load.

(Smalltalk at: #ConfigurationOfPetitCompiler) perform: #'loadForPillar'.

...but this loads many unused stuff, such as Roassal and PetitJava.

DamienCassou commented 9 years ago

All Pillar unit tests pass now. But I can't compile the EnterprisePharo book (sbabook branch) because of the Oops! error

DamienCassou commented 9 years ago

Ok, everything is in place!

Before

$ rm -rf book-result && time ./pillar export
To compile your LaTeX files launch "bash pillarPostExport.sh".

real    0m15.499s
user    0m15.430s
sys 0m0.086s

and after:

$ rm -rf book-result && time ./pillar export
To compile your LaTeX files launch "bash pillarPostExport.sh".

real    0m8.673s
user    0m8.602s
sys 0m0.080s
DamienCassou commented 9 years ago

What is missing now:

DamienCassou commented 9 years ago

Speed should increase again after issue #84 is fixed

DamienCassou commented 9 years ago

/cc @cdlm @jecisc

janvrany commented 9 years ago

To answer some of the questions:

many tests fail in Pharo 5

To run tests in Extras package, you need to download and unpack some archives with test files. Basically the're are smoke-tests to check whether stuff is running on real grammars. You don't need to worry about that - and we need to split that up. PEGFsaGeneratorTest>>#testAAAorA_Astar PEGFsaMinimizationTest>>#testMinimze4 are expected failures. The rest should be fixed, indeed. I'll check with Jan and let you know once fixed.

PRPillarParser new compile returns an instance of PPGeneratedParser. Should I cache this instance or is there a class I can re-instantiate when needed?

No need to cache the instance. You may instantiate the PPGeneratedParser and use a fresh instance. However, you may want to compile parser into some class with more suitable name. To do so:

PRPillarParser new compileWithOptions: #( parserName: #PRPillarParserCompiled )

(just updated docs a little: https://bitbucket.org/janvrany/stx-goodies-petitparser/wiki/BasicUsage)