GithubHelp home page GithubHelp logo

Comments (14)

facontidavide avatar facontidavide commented on June 3, 2024

UPDATE: Shaving even more performance out of the benchmark.

Version 0.8 (master): 560 ms
Version 1.0 beta (dev): 220 ms

from ros_type_introspection.

ibtaylor avatar ibtaylor commented on June 3, 2024

I dropped some comments on commits here (should see with little message box) https://github.com/facontidavide/ros_type_introspection/commits/dev

from ros_type_introspection.

ibtaylor avatar ibtaylor commented on June 3, 2024

fyi, in dev, tests fail

from ros_type_introspection.

ibtaylor avatar ibtaylor commented on June 3, 2024

these methods should probably be const methods as in void method() => void method() const since they do not/should not mutate object state

const ROSMessageInfo* getMessageInfo(const std::string& msg_identifier);

const ROSMessage *getMessageByType(const ROSType& type, const ROSMessageInfo &info);

void deserializeIntoFlatContainer(const std::string& msg_identifier,
const nonstd::VectorView<uint8_t>& buffer,
ROSTypeFlat* flat_container_output,
const uint32_t max_array_size );

void applyVisitorToBuffer(const std::string& msg_identifier, const ROSType &monitored_type,
nonstd::VectorViewMutable<uint8_t> &buffer,
VisitingCallback callback);

this can be made const
void applyNameTransform(const std::string& msg_identifier,
const ROSTypeFlat& container,
RenamedValues* renamed_value );

if
const std::vector<RulesCache>& rules_cache = _registered_rules[msg_identifier];

is changed from operator[] which will do an insertion (unwanted probably) with .at()

from ros_type_introspection.

ibtaylor avatar ibtaylor commented on June 3, 2024

helper_funtions.hpp => helper_functions.hpp

from ros_type_introspection.

facontidavide avatar facontidavide commented on June 3, 2024

thank you for the valuable remarks, I completely missed the typos and the const.

Test is not failing on my most up to date version. If it still fails on your PC, send me the error message.

from ros_type_introspection.

ibtaylor avatar ibtaylor commented on June 3, 2024

ran tests on commit c77c728

[==========] Running 16 tests from 5 test cases.
[----------] Global test environment set-up.
[----------] 5 tests from RosType
[ RUN      ] RosType.builtin_int32
[       OK ] RosType.builtin_int32 (0 ms)
[ RUN      ] RosType.builtin_string
[       OK ] RosType.builtin_string (0 ms)
[ RUN      ] RosType.builtin_fixedlen_array
/data2/ws_gcc/ws_ros_lunar/src/ros_type_introspection/src/tests/parser_test.cpp:51: Failure
      Expected: f.arraySize()
      Which is: 0
To be equal to: 32
[  FAILED  ] RosType.builtin_fixedlen_array (0 ms)
[ RUN      ] RosType.builtin_dynamic_array
[       OK ] RosType.builtin_dynamic_array (0 ms)
[ RUN      ] RosType.no_builtin_array
[       OK ] RosType.no_builtin_array (0 ms)
[----------] 5 tests from RosType (1 ms total)

[----------] 4 tests from ROSMessageFields
[ RUN      ] ROSMessageFields.ParseComments
[       OK ] ROSMessageFields.ParseComments (0 ms)
[ RUN      ] ROSMessageFields.constant_uint8
[       OK ] ROSMessageFields.constant_uint8 (0 ms)
[ RUN      ] ROSMessageFields.ConstantNavstatus
[       OK ] ROSMessageFields.ConstantNavstatus (1 ms)
[ RUN      ] ROSMessageFields.ConstantComments
[       OK ] ROSMessageFields.ConstantComments (1 ms)
[----------] 4 tests from ROSMessageFields (2 ms total)

[----------] 2 tests from BuildROSTypeMapFromDefinition
[ RUN      ] BuildROSTypeMapFromDefinition.IMUparsing
/data2/ws_gcc/ws_ros_lunar/src/ros_type_introspection/src/tests/parser_test.cpp:255: Failure
      Expected: msg->field(2).arraySize()
      Which is: 5
To be equal to: 9
/data2/ws_gcc/ws_ros_lunar/src/ros_type_introspection/src/tests/parser_test.cpp:262: Failure
      Expected: msg->field(4).arraySize()
      Which is: 5
To be equal to: 9
/data2/ws_gcc/ws_ros_lunar/src/ros_type_introspection/src/tests/parser_test.cpp:269: Failure
      Expected: msg->field(6).arraySize()
      Which is: 0
To be equal to: 9
[  FAILED  ] BuildROSTypeMapFromDefinition.IMUparsing (3 ms)
[ RUN      ] BuildROSTypeMapFromDefinition.Int16MultiArrayParsing
[       OK ] BuildROSTypeMapFromDefinition.Int16MultiArrayParsing (1 ms)
[----------] 2 tests from BuildROSTypeMapFromDefinition (4 ms total)

[----------] 4 tests from Deserialize
[ RUN      ] Deserialize.JointState
[       OK ] Deserialize.JointState (2 ms)
[ RUN      ] Deserialize.NavSatStatus
[       OK ] Deserialize.NavSatStatus (1 ms)
[ RUN      ] Deserialize.DeserializeIMU
unknown file: Failure
C++ exception with description "buildRosFlatType: There was an error parsing the buffer" thrown in the test body.
[  FAILED  ] Deserialize.DeserializeIMU (2 ms)
[ RUN      ] Deserialize.Int16MultiArrayDeserialize
[       OK ] Deserialize.Int16MultiArrayDeserialize (1 ms)
[----------] 4 tests from Deserialize (6 ms total)

[----------] 1 test from Renamer2
[ RUN      ] Renamer2.DeserializeJointStateAndRename
[       OK ] Renamer2.DeserializeJointStateAndRename (2 ms)
[----------] 1 test from Renamer2 (2 ms total)

[----------] Global test environment tear-down
[==========] 16 tests from 5 test cases ran. (15 ms total)
[  PASSED  ] 13 tests.
[  FAILED  ] 3 tests, listed below:
[  FAILED  ] RosType.builtin_fixedlen_array
[  FAILED  ] BuildROSTypeMapFromDefinition.IMUparsing
[  FAILED  ] Deserialize.DeserializeIMU

 3 FAILED TESTS

from ros_type_introspection.

facontidavide avatar facontidavide commented on June 3, 2024

I do not have this problem. Which compiler are you using?

Which Boost version?

from ros_type_introspection.

ibtaylor avatar ibtaylor commented on June 3, 2024

I'm using ros lunar. Compiler gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)

from ros_type_introspection.

facontidavide avatar facontidavide commented on June 3, 2024

:( I will try to install a version of lunar and see why this is happening. It is super weird.
Could it be a problem with atoi? Can you debug it on your computer and check the value of these lines for the failing tests?

  std::string size(what[3].first, what[3].second);
  _array_size = size.empty() ? -1 : atoi(size.c_str());

from ros_type_introspection.

ibtaylor avatar ibtaylor commented on June 3, 2024

okay, I found that problem. assigning to type after the match will corrupt the results.
doing

std::string type_tmp = type;
if (regex_search(type_tmp, what, array_regex))

works fine

from ros_type_introspection.

facontidavide avatar facontidavide commented on June 3, 2024

Awesome! Just pushed the fix

from ros_type_introspection.

facontidavide avatar facontidavide commented on June 3, 2024

I am about to close this and merge dev into master (and release it on ROS Indigo, Kinetic and Lunar).

The refactoring is not 3X faster than the original code and looking at the results of Callgrind I can not see any low hanging fruit for further optimization.

from ros_type_introspection.

facontidavide avatar facontidavide commented on June 3, 2024

pushed

from ros_type_introspection.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.