-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #159 from tonybaloney/profile_app
Improve performance by 2x and add a basic benchmark test
- Loading branch information
Showing
41 changed files
with
1,026 additions
and
471 deletions.
There are no files selected for viewing
21 changes: 2 additions & 19 deletions
21
src/CSnakes.Runtime.Tests/Converter/BigIntegerConverterTest.cs
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 |
---|---|---|
@@ -1,33 +1,16 @@ | ||
using CSnakes.Runtime.Python; | ||
using System.ComponentModel; | ||
using System.Numerics; | ||
|
||
namespace CSnakes.Runtime.Tests.Converter; | ||
|
||
public class BigIntegerConverterTest : RuntimeTestBase | ||
public class BigIntegerConverterTest : ConverterTestBase | ||
{ | ||
[Fact] | ||
public void TestVeryBigNumbers() | ||
{ | ||
const string number = "12345678987654345678764345678987654345678765"; | ||
TypeConverter td = TypeDescriptor.GetConverter(typeof(PyObject)); | ||
// Something that is too big for a long (I8) | ||
BigInteger input = BigInteger.Parse(number); | ||
|
||
Assert.True(td.CanConvertFrom(typeof(BigInteger))); | ||
|
||
using (GIL.Acquire()) | ||
{ | ||
using PyObject? pyObj = td.ConvertFrom(input) as PyObject; | ||
|
||
Assert.NotNull(pyObj); | ||
Assert.Equal(number, pyObj!.ToString()); | ||
|
||
Assert.True(td.CanConvertTo(typeof(BigInteger))); | ||
|
||
// Convert back | ||
BigInteger integer = (BigInteger) td.ConvertTo(pyObj, typeof(BigInteger))!; | ||
Assert.Equal(input, integer); | ||
} | ||
RunTest(input); | ||
} | ||
} |
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
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
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
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.