Browse files

Disable use of cached .reb files if they exist

Reia drops .reb files onto the filesystem whenever it loads a .re file
(similar to how Rubinius drops .rbc files which contain compiled Ruby
code). This is a great performance improvement becasue it means we don't
need to run the Reia compiler unless a particular source code file has changed.

However, if we're making major changes to things like the parser (like, say,
switching it to a PEG) this means the parser won't get exercised because
Reia is using the existing .reb files instead.

I've added a USE_BIN_CACHE macro to the top of reia_internal.erl which allows
an easy way of toggling this behavior on and off depending on if it's desired.
  • Loading branch information...
1 parent 4f8eb29 commit 8cd53c996727ab79d23c9cb35a5f687df066694b Tony Arcieri committed Feb 3, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/core/reia_internal.erl
View
5 src/core/reia_internal.erl
@@ -18,6 +18,9 @@
]).
-include("reia_types.hrl").
+% Enable or disable use of compiled .reb files if available
+-define(USE_BIN_CACHE, false).
+
% Walk the Reia load path attempting to load the given file
load([], _Filename) ->
{error, enoent};
@@ -35,7 +38,7 @@ load([BasePath|Rest], Filename) ->
% Ensure changes haven't been made to the sources
if
- BinMtime > SourceMtime ->
+ BinMtime > SourceMtime and ?USE_BIN_CACHE ->
void;
true ->
reia_internal:compile(SourcePath, BinPath)

0 comments on commit 8cd53c9

Please sign in to comment.