Skip to content

Commit

Permalink
Update introduction.md
Browse files Browse the repository at this point in the history
With optimization information
  • Loading branch information
Thomas Hansen committed Jan 20, 2019
1 parent adb3722 commit e2d090f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,22 @@ as the Binder is created. See the `Foo2` method above to understand what this
implies, and notice how it's taking a `Binder<BaseClass>` instance, even though
it is declared in the `SuperClass`.

### Optimizing Lizzie

Internally when you create a `Binder`, which is responsible for binding your Lizzie
code to your context instance, Lizzie will use reflection, and also compile lambda
expressions. This process is relatively expensive in terms of CPU usage. However,
if you know that you will bind to the same type frequently, you can internally
cache your binder, for then to `Clone` your _"master"_ binder each time you want to
evaluate a piece of Lizzie code bound towards the same `Binder` type. For a web
application, frequently compiling a new piece of Lizzie snippet, this would probably
increase the performance of the compilation process by several orders of magnitudes.

If you know that you will evaluate the same snippet of Lizzie code multiple
times, you can also cache the lambda returned by the compilation process itself.
Which would further increase your performance. However, Lizzie will never be as
fast as compiled C# code, due to its dynamic nature.

### Donate

If you feel Lizzie has given you value, I would
Expand Down

0 comments on commit e2d090f

Please sign in to comment.