You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-4Lines changed: 25 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,10 +26,6 @@ clauses with binary matching. This provides the following benefits:
26
26
the possibility to compile parsers and do not impose a dependency on
27
27
users of your library
28
28
29
-
* No footprints: `NimbleParsec` only needs to be imported in your modules.
30
-
There is no need for `use NimbleParsec`, leaving no footprints on your
31
-
modules
32
-
33
29
The goal of this library is to focus on a set of primitives for writing
34
30
efficient parser combinators. The composition aspect means you should be
35
31
able to use those primitives to implement higher level combinators.
@@ -113,6 +109,31 @@ hand-written parsers. This gives `NimbleParsec` an order of magnitude
113
109
performance gains compared to other parser combinators. Further performance
114
110
can be gained by giving the `inline: true` option to `defparsec/3`.
115
111
112
+
## Performance considerations
113
+
114
+
This library works by aggressively inlining code. For example, when we defined `date` and `time` combinators above, if you happen to use them in different occasions as follows, they will be inlined and compiled multiple times:
Because each `date` and `time` node appears twice, they will be compiled twice. This means that reusing combinators over and over again can lead to memory usage during compilation as well as high compile times.
123
+
124
+
To address this, `NimbleParsec` allows you to encapsulate combinators and reuse them, using `defpcombinatorp`:
0 commit comments