tqchen commented on code in PR #443:
URL: https://github.com/apache/tvm-ffi/pull/443#discussion_r2805843597
##########
src/ffi/extra/structural_equal.cc:
##########
@@ -302,6 +309,33 @@ class StructEqualHandler {
// NOLINTNEXTLINE(performance-unnecessary-value-param)
bool CompareArray(ffi::Array<Any> lhs, ffi::Array<Any> rhs) {
+ return CompareSequence(std::move(lhs), std::move(rhs));
+ }
+
+ // NOLINTNEXTLINE(performance-unnecessary-value-param)
+ bool CompareList(ffi::List<Any> lhs, ffi::List<Any> rhs) {
+ return CompareSequence(std::move(lhs), std::move(rhs));
+ }
+
+ template <typename SeqType>
+ // NOLINTNEXTLINE(performance-unnecessary-value-param)
+ bool CompareSequence(SeqType lhs, SeqType rhs) {
+ const Object* lhs_ptr = lhs.get();
+ const Object* rhs_ptr = rhs.get();
+ auto pair = std::make_pair(lhs_ptr, rhs_ptr);
+ if (active_sequence_pairs_.count(pair)) {
Review Comment:
main reason is for sequal/hash there can be more kind of cycles, so only
doing it for list is a bit limited, and usually the usecase is for non-cycle,
so keeping things simple here should be good. we can use cycle detection in
json dumps
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]