-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
NoReaderMacros
parsing mode for speed
- Loading branch information
Showing
12 changed files
with
333 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace IxMilia.Lisp.Test | ||
{ | ||
public class ObjectReadTests_NoReaderMacros: ObjectReadTestsBase | ||
{ | ||
public override LispReaderType ReaderType => LispReaderType.NoReaderMacros; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace IxMilia.Lisp.Test | ||
{ | ||
public class TimingTests : TestBase | ||
{ | ||
[Fact] | ||
public async Task ReadCodeAsync() | ||
{ | ||
var assemblyDirectory = Path.GetDirectoryName(GetType().Assembly.Location); | ||
var fullFilePath = Path.Combine(assemblyDirectory, "runtime-tests.lisp"); | ||
var fileContents = File.ReadAllText(fullFilePath); | ||
var code = "(progn\n" + fileContents + "\n)\n"; | ||
var results = new StringBuilder(); | ||
foreach (var readerType in new[] { LispReaderType.Compiled, LispReaderType.NoReaderMacros }) | ||
{ | ||
var host = await CreateHostAsync(); | ||
host.SetReaderFunction(readerType); | ||
|
||
for (int i = 0; i < 2; i++) | ||
{ | ||
var executionState = host.CreateExecutionState(); | ||
var reader = new StringReader(code); | ||
var stream = new LispTextStream("TEST-INPUT", reader, TextWriter.Null); | ||
var obj = LispList.FromItems(new LispUnresolvedSymbol("READ"), stream); | ||
var sw = new Stopwatch(); | ||
sw.Start(); | ||
var evalResult = await host.EvalAsync(obj, executionState); | ||
sw.Stop(); | ||
EnsureNotError(evalResult.Value); | ||
|
||
if (i == 1) | ||
{ | ||
results.AppendLine($"{readerType}: {sw.ElapsedMilliseconds}ms"); | ||
} | ||
} | ||
} | ||
|
||
// uncomment to see timings | ||
//Assert.Fail(results.ToString()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.