Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hocon improvement. #218

Merged
merged 7 commits into from Feb 12, 2020
Merged

Hocon improvement. #218

merged 7 commits into from Feb 12, 2020

Conversation

Arkatufus
Copy link
Contributor

@Arkatufus Arkatufus commented Feb 10, 2020

Still related to akkadotnet/akka.net#4128

  • Add IEquitable<Config> interface implementation to Config class
  • GetString(), GetStringList(), GetInt(), and GetDouble() throws on failure instead of returning a default value (Major change in Akka.NET).
  • Add TryGet[DataType]() functions to all getters to eliminate as much Exception throwing as possible to improve performance.
  • Remove as much wrapping functions as possible to improve performance.
  • Move ConfigurationException from Akka.Configuration to Hocon
  • Fix Config.WithFallback() with hocon files containing substitution failed to merge the fallbacks correctly.

- GetString(), GetStringList(), GetInt(), and GetDouble() throws on failure instead of returning a default value (Major change in Akka.NET).
- Add TryGet[DataType]() functions to all getters to eliminate as much Exception throwing as possible to improve performance.
- Remove as much wrapping functions as possible to improve performance.
- Fix Config.Equal infinite loop bug.
@Arkatufus Arkatufus changed the title Hocon improvement. [WIP] Hocon improvement. Feb 10, 2020
@Aaronontheweb
Copy link
Member

Add TryGetDataType functions to all getters to eliminate as much Exception throwing as possible to improve performance.

Love that idea.

@Arkatufus Arkatufus changed the title [WIP] Hocon improvement. Hocon improvement. Feb 12, 2020
Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look fantastic. Big improvements here.

ReferenceEquals(oldA, a).Should().BeTrue();
oldAContent.Should().Equals(a);
}

[Fact]
public void WithFallback_ShouldMergeSubstitutionProperly()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is the reproduction case you were talking about. Good, glad we have it.

public Config Config {
get
{
if (_config == null && !string.IsNullOrWhiteSpace(Hocon.Content))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good optimization

@@ -54,22 +54,38 @@ public HoconRoot(HoconValue value, IEnumerable<HoconSubstitution> substitutions)
/// </summary>
public IEnumerable<HoconSubstitution> Substitutions { get; private set; }

protected virtual HoconValue GetNode(HoconPath path, bool throwIfNotFound = false)
protected virtual bool TryGetNode(string path, out HoconValue result)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition

{
return WrapWithValueException(path.ToString(), () =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These designs, using the Try methods instead of WrapWithValueException, are a major improvement.

@Aaronontheweb Aaronontheweb merged commit 28a54b6 into akkadotnet:dev Feb 12, 2020
@Aaronontheweb Aaronontheweb mentioned this pull request Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants