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

Fix and optimize name handling in TypeInfo. #3349

Merged
merged 2 commits into from
Sep 20, 2021

Conversation

mzient
Copy link
Contributor

@mzient mzient commented Sep 17, 2021

  • Improve name handling in TypeInfo.
  • Simplify TypeInfo default constructor.
  • Fix stringification of custom type ids.
  • Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz mzient@gmail.com

Description

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (Redesign of existing code that doesn't affect functionality)
  • Other (e.g. Documentation, Tests, Configuration)

What happened in this PR

  • optimize name stringification by providing a fast path for names of built-in types
  • provide separate implementations of operator<< and to_string to gain further speedup
  • get the name of custom types from TypeTable and use it in to_string and operator<< for DALIDataType

Additional information

  • Affected modules and functionalities:
  • Key points relevant for the review:

Checklist

Tests

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

New test: test TypeInfo for a custom type.

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: N/A

* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [3002968]: BUILD STARTED

@JanuszL JanuszL self-assigned this Sep 17, 2021
auto *info = TypeTable::TryGetTypeInfo(dtype);
if (info)
return os << info->name();
// Use string concatenation so that the result is the same aas in to_string, unaffected by
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Use string concatenation so that the result is the same aas in to_string, unaffected by
// Use string concatenation so that the result is the same as in to_string, unaffected by

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. I'll report anyone who launches CI for that to EPA ;)

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [3002968]: BUILD PASSED

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
@mzient mzient merged commit 84060c7 into NVIDIA:main Sep 20, 2021
cyyever pushed a commit to cyyever/DALI that referenced this pull request Oct 17, 2021
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Jan 23, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Jan 23, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Jan 23, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Jan 23, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Jan 23, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Jan 23, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Jan 23, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Jan 23, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Jan 23, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Jan 23, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Jan 23, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Jan 23, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Jan 23, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Feb 21, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request May 13, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
cyyever pushed a commit to cyyever/DALI that referenced this pull request Jun 7, 2022
* Improve name handling in TypeInfo.
* Simplify TypeInfo default constructor.
* Fix stringification of custom type ids.
* Add test for custom name stringification.

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
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.

4 participants