Project

General

Profile

Actions

Task #4856

closed

Unnecesary conversion to URI in calling isFutureHash

Added by Anonymous about 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Target version:
-
Start date:
02/25/2019
Due date:
% Done:

0%

Estimated time:

Description

The isFutureHash method takes a Name:

FullProducer::isFutureHash(const ndn::Name& prefix, const std::set<uint32_t>& negative)

When FullProducer::onSyncInterest calls isFutureHash, it converts the Name to a URI string. Then the compiler automatically calls the Name constructor to convert the URI back to a Name.
https://github.com/named-data/PSync/blob/e5fdcc3744d3787949aec0ef23ba9fc8a7db4572/PSync/full-producer.cpp#L198

if (m_prefixes[prefix] != 0 && !isFutureHash(prefix.toUri(), negative)) {

I think you can omit .toUri() and save some unnecessary conversion.

if (m_prefixes[prefix] != 0 && !isFutureHash(prefix, negative)) {

(This is a low priority observation. Feel free to ignore.)

Actions #1

Updated by Anonymous about 5 years ago

  • Subject changed from Unnecesary conversion to URI in calling to Unnecesary conversion to URI in calling isFutureHash
  • Status changed from New to Closed

In the updated code with FullProducerArbitrary, the call to isFutureHash is no through the CanAddName callback, which correctly is passed the Name without converting to a URI.

https://github.com/8th-ndn-hackathon/PSync/blob/5d8d047a7e44239adeea5c6209201bef7b355d07/PSync/full-producer-arbitrary.cpp#L269

This issue is resolved. Closing.

Actions

Also available in: Atom PDF