Skip to content

Small optimizations#74

Merged
SergeiPavlov merged 5 commits intomaster-servicetitanfrom
optimizations
Jul 18, 2022
Merged

Small optimizations#74
SergeiPavlov merged 5 commits intomaster-servicetitanfrom
optimizations

Conversation

@SergeiPavlov
Copy link
Copy Markdown
Collaborator

@SergeiPavlov SergeiPavlov commented Jul 16, 2022

Optimizations:

  • replace if (node.Expression is not null) Visit(node.Expression); -> VisitNullable(node.Expression); to avoid double property dereference
  • replace new T[0] -> Array.Empty<T>();
  • Avoid multiple method.Name property dereference

Also:

  • Remove unused class PriorityQueue<> - it is standard class in .NET6

@SergeiPavlov SergeiPavlov requested a review from botinko July 16, 2022 08:06
@SergeiPavlov SergeiPavlov merged commit 8bd1a09 into master-servicetitan Jul 18, 2022
@SergeiPavlov SergeiPavlov deleted the optimizations branch July 18, 2022 23:47
SergeiPavlov added a commit that referenced this pull request Jul 21, 2022
* Optimize VisitMethodCall()

* Optimize Provider constructor

* Use Array.Empty<T>() instead of allocating Empty array

* Get rid of unused PriorityQueue<> class

* VisitNullable()
SergeiPavlov pushed a commit that referenced this pull request Jul 18, 2023
SergeiPavlov added a commit that referenced this pull request Jul 18, 2023
* Small optimizations (#74)

* Optimize VisitMethodCall()

* Optimize Provider constructor

* Use Array.Empty<T>() instead of allocating Empty array

* Get rid of unused PriorityQueue<> class

* VisitNullable()

* make VisitNullable() private

* SqlServer: Both US English and British English are considered english

* Improve changelog

* Change version to next developing

* Add changelog file

* After merge changes

- TestHelper.AddValueRow() is for all build targets
- SqlSessionHandler: shared code for async and sync Execute + renames
- TemporaryTableManager: removed unused code
- CommandFactory: removed commented code
- DomainConfuguration: fixed bug of MaxNumberOfConditions value not being
  validated (added tests to make sure that validation happens)
- Test for temp table popupation
- Updated MaxQueryParameterCount for Oracle and PostgreSQL 9.0+

* Add new storage configurations + enrich supported databases list

* Fixed bad merge results

* Remove usage of obsolete SqlInsert.Values from object cloning

* Changelog improved

* Fix build

---------

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>
SergeiPavlov added a commit that referenced this pull request Jul 19, 2023
* Use C#9 Covariant return types feature for Clone() implementation for more type safety

* Make SqlNodeCloneContext readonly struct

* Continue refactoring

* Refactor other Clone()

* Get rid of IsNullReference() in modified lines

* Small optimizations (#74)

* Optimize VisitMethodCall()

* Optimize Provider constructor

* Use Array.Empty<T>() instead of allocating Empty array

* Get rid of unused PriorityQueue<> class

* VisitNullable()

* Update Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlUserFunctionCall.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* Update Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlFunctionCall.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* Update Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlCustomFunctionCall.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* make VisitNullable() private

* ToArray(t.tables.Length) for consistency

* SqlServer: Both US English and British English are considered english

* Improve changelog

* Fix build

* Change version to next developing

* Add changelog file

* After merge changes

- TestHelper.AddValueRow() is for all build targets
- SqlSessionHandler: shared code for async and sync Execute + renames
- TemporaryTableManager: removed unused code
- CommandFactory: removed commented code
- DomainConfuguration: fixed bug of MaxNumberOfConditions value not being
  validated (added tests to make sure that validation happens)
- Test for temp table popupation
- Updated MaxQueryParameterCount for Oracle and PostgreSQL 9.0+

* Add new storage configurations + enrich supported databases list

* Fixed bad merge results

* Remove usage of obsolete SqlInsert.Values from object cloning

* Changelog improved

* Update Orm/Xtensive.Orm/Sql/Internals/SqlNodeCloneContext.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* Fix SqlTruncateTable.Clone()

* Fix build

* Refactor SqlInsert.Clone()

* Changelog improved

---------

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>
SergeiPavlov added a commit that referenced this pull request Jul 27, 2023
* Use C#9 Covariant return types feature for Clone() implementation for more type safety

* Make SqlNodeCloneContext readonly struct

* Continue refactoring

* Refactor other Clone()

* Get rid of IsNullReference() in modified lines

* Small optimizations (#74)

* Optimize VisitMethodCall()

* Optimize Provider constructor

* Use Array.Empty<T>() instead of allocating Empty array

* Get rid of unused PriorityQueue<> class

* VisitNullable()

* Avoid unnecessary CompilableProvier castings (#84)

* Update Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlUserFunctionCall.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* Update Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlFunctionCall.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* Update Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlCustomFunctionCall.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* make VisitNullable() private

* ToArray(t.tables.Length) for consistency

* SqlServer: Both US English and British English are considered english

* Improve changelog

* Fix build

* Change version to next developing

* Add changelog file

* After merge changes

- TestHelper.AddValueRow() is for all build targets
- SqlSessionHandler: shared code for async and sync Execute + renames
- TemporaryTableManager: removed unused code
- CommandFactory: removed commented code
- DomainConfuguration: fixed bug of MaxNumberOfConditions value not being
  validated (added tests to make sure that validation happens)
- Test for temp table popupation
- Updated MaxQueryParameterCount for Oracle and PostgreSQL 9.0+

* Add new storage configurations + enrich supported databases list

* Fixed bad merge results

* Remove usage of obsolete SqlInsert.Values from object cloning

* Changelog improved

* Update Orm/Xtensive.Orm/Sql/Internals/SqlNodeCloneContext.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* Fix SqlTruncateTable.Clone()

* Fix build

* Refactor SqlInsert.Clone()

* Changelog improved

* Return CompilableProvider from Visitors

* Proposes changes on top of DataObjects-NET#274 (#134)

* Make CompilableProviderVisitor API declaration for provider vistitors

- ProviderVisitor no longer parent type for any other type and [Obsolete]
- ProviderVisitor changes reverted
- CompilableProviderVisitor gets protected Visit method from ProviderVisitor
  and all the summaries coppied; also changes signature of expressionTranslator
  to not allow having Provider as incoming parameter and cause issies.

* Apply covariant returns to CompilableProviderVisitor descendants

* CompilableProviderVisitor: convert IFs to conditionals

* Revert obsolescence of ProviderVisitor

---------

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>
SergeiPavlov added a commit that referenced this pull request Jul 27, 2023
* Use C#9 Covariant return types feature for Clone() implementation for more type safety

* Make SqlNodeCloneContext readonly struct

* Continue refactoring

* Refactor other Clone()

* Get rid of IsNullReference() in modified lines

* Small optimizations (#74)

* Optimize VisitMethodCall()

* Optimize Provider constructor

* Use Array.Empty<T>() instead of allocating Empty array

* Get rid of unused PriorityQueue<> class

* VisitNullable()

* Avoid unnecessary CompilableProvier castings (#84)

* Fix hinding exception & StackTrace in OpenSessionInternalAsync()

* Flatten AggregateException with single inner exception

* Update Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlUserFunctionCall.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* Update Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlFunctionCall.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* Update Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlCustomFunctionCall.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* make VisitNullable() private

* ToArray(t.tables.Length) for consistency

* SqlServer: Both US English and British English are considered english

* Improve changelog

* Fix build

* Change version to next developing

* Add changelog file

* After merge changes

- TestHelper.AddValueRow() is for all build targets
- SqlSessionHandler: shared code for async and sync Execute + renames
- TemporaryTableManager: removed unused code
- CommandFactory: removed commented code
- DomainConfuguration: fixed bug of MaxNumberOfConditions value not being
  validated (added tests to make sure that validation happens)
- Test for temp table popupation
- Updated MaxQueryParameterCount for Oracle and PostgreSQL 9.0+

* Add new storage configurations + enrich supported databases list

* Fixed bad merge results

* Remove usage of obsolete SqlInsert.Values from object cloning

* Changelog improved

* Update Orm/Xtensive.Orm/Sql/Internals/SqlNodeCloneContext.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* Fix SqlTruncateTable.Clone()

* Fix build

* Refactor SqlInsert.Clone()

* Changelog improved

* Return CompilableProvider from Visitors

* Proposes changes on top of DataObjects-NET#274 (#134)

* Make CompilableProviderVisitor API declaration for provider vistitors

- ProviderVisitor no longer parent type for any other type and [Obsolete]
- ProviderVisitor changes reverted
- CompilableProviderVisitor gets protected Visit method from ProviderVisitor
  and all the summaries coppied; also changes signature of expressionTranslator
  to not allow having Provider as incoming parameter and cause issies.

* Apply covariant returns to CompilableProviderVisitor descendants

* CompilableProviderVisitor: convert IFs to conditionals

* Revert obsolescence of ProviderVisitor

* Improve changelog

---------

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>
SergeiPavlov added a commit that referenced this pull request Jul 28, 2023
* Use C#9 Covariant return types feature for Clone() implementation for more type safety

* Make SqlNodeCloneContext readonly struct

* Continue refactoring

* Refactor other Clone()

* Get rid of IsNullReference() in modified lines

* Small optimizations (#74)

* Optimize VisitMethodCall()

* Optimize Provider constructor

* Use Array.Empty<T>() instead of allocating Empty array

* Get rid of unused PriorityQueue<> class

* VisitNullable()

* Avoid unnecessary CompilableProvier castings (#84)

* Avoid unnecessary CompilableProvier castings (#84)

* Refactor ProviderVisitor to avoid code duplication (#86)

* Fix hinding exception & StackTrace in OpenSessionInternalAsync()

* Flatten AggregateException with single inner exception

* Update Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlUserFunctionCall.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* Update Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlFunctionCall.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* Update Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlCustomFunctionCall.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* make VisitNullable() private

* ToArray(t.tables.Length) for consistency

* SqlServer: Both US English and British English are considered english

* Improve changelog

* Fix build

* Change version to next developing

* Add changelog file

* After merge changes

- TestHelper.AddValueRow() is for all build targets
- SqlSessionHandler: shared code for async and sync Execute + renames
- TemporaryTableManager: removed unused code
- CommandFactory: removed commented code
- DomainConfuguration: fixed bug of MaxNumberOfConditions value not being
  validated (added tests to make sure that validation happens)
- Test for temp table popupation
- Updated MaxQueryParameterCount for Oracle and PostgreSQL 9.0+

* Add new storage configurations + enrich supported databases list

* Fixed bad merge results

* Remove usage of obsolete SqlInsert.Values from object cloning

* Changelog improved

* Update Orm/Xtensive.Orm/Sql/Internals/SqlNodeCloneContext.cs

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>

* Fix SqlTruncateTable.Clone()

* Fix build

* Refactor SqlInsert.Clone()

* Changelog improved

* Return CompilableProvider from Visitors

* Proposes changes on top of DataObjects-NET#274 (#134)

* Make CompilableProviderVisitor API declaration for provider vistitors

- ProviderVisitor no longer parent type for any other type and [Obsolete]
- ProviderVisitor changes reverted
- CompilableProviderVisitor gets protected Visit method from ProviderVisitor
  and all the summaries coppied; also changes signature of expressionTranslator
  to not allow having Provider as incoming parameter and cause issies.

* Apply covariant returns to CompilableProviderVisitor descendants

* CompilableProviderVisitor: convert IFs to conditionals

* Revert obsolescence of ProviderVisitor

* Improve changelog

* After-merge fix

* Prevent continuation happening if parent task was canceled

otherwise OperationCanceledException will be swallowed

---------

Co-authored-by: Alexey Kulakov <alexey.kulakov@dataobjects.net>
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.

2 participants