- Break embedding out into a separate section with multiple pages.
- Document the constraints on the API.
- Document the slot array and WrenValue.
Still lots more to do, but getting there...
This has a couple of pros:
- It simplifies some code that used to have to check whether a called
thing is a bare function or a closure.
- It's faster because we don't need to do the above checks every time
something is called.
- It lets us more precisely type some fields that used to be Obj*
because they could hold an ObjClosure* or ObjFn*.
The cost is that we allocate a closure every time a function is
declared, even if it has no upvalues. Since functions are called way
more often than they are declared, this is still a net win.
On my Mac laptop:
api_call - wren 0.06s 0.0020 104.73%
api_foreign_method - wren 0.32s 0.0040 101.89%
binary_trees - wren 0.23s 0.0057 98.82%
binary_trees_gc - wren 0.79s 0.0170 98.46%
delta_blue - wren 0.13s 0.0031 101.36%
fib - wren 0.23s 0.0038 103.15%
fibers - wren 0.04s 0.0017 98.97%
for - wren 0.08s 0.0017 107.81%
method_call - wren 0.12s 0.0024 98.60%
map_numeric - wren 0.31s 0.0052 103.93%
map_string - wren 0.11s 0.0113 97.97%
string_equals - wren 0.20s 0.0023 107.75%
commit f93ec6430f9629b5a28765a3961379d1e8296e50
Author: Bob Nystrom <robert@stuffwithstuff.com>
Date: Wed Mar 16 08:03:25 2016 -0700
Tiny tweaks.
commit 332a08fe33cddffec82dbd377ee0c941a0066f64
Merge: a67398114b7a08
Author: Bob Nystrom <robert@stuffwithstuff.com>
Date: Wed Mar 16 08:01:00 2016 -0700
Merge branch 'errorFn' of https://github.com/ppvk/wren into ppvk-errorFn
commit 14b7a086ce
Author: Paul VanKeuren <paul.vankeuren@gmail.com>
Date: Tue Mar 15 11:33:37 2016 -0500
missing semicolon, accessing vm through parser in
commit 924eaa1f9d
Author: Paul VanKeuren <paul.vankeuren@gmail.com>
Date: Tue Mar 15 11:25:32 2016 -0500
fixed missing errorFn in wren.h
commit 3761df111f
Author: Paul VanKeuren <paul.vankeuren@gmail.com>
Date: Tue Mar 15 11:23:51 2016 -0500
Added an errorFn to the CLI
commit d51137b4ab
Author: Paul VanKeuren <paul.vankeuren@gmail.com>
Date: Tue Mar 15 11:21:16 2016 -0500
Added a WrenErrorFn typedef, an errorFn slot in WrenConfiguration. exits early if is not defined, otherwise it runs the errorFn .
Avoids using multiple calls to fprintf() to print a single compile
error. This should make it easier to allow the host to provide a
callback function to print errors.
The compiler used to maintain all of the data that defines a function,
which it incrementally built up. Then, when it was done, it copied all
of that to a new ObjFn. In theory, that was to trim down some memory
and avoid unneeded fields in ObjFn.
In practice, the performance benefit is negligible and the memory saving
is nullified by the fact that it copies anyway.
This moves all of that mutable state directly into ObjFn. The compiler
creates a new empty ObjFn at the beginning and then just fills it in
in place.
This shaves off about 40 lines of code, is simpler, and doesn't seem to
impact perf.