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

INTERNAL: Change DFS traverse order in set and map #815

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

jeesup0103
Copy link

@jeesup0103 jeesup0103 commented Jan 3, 2025

πŸ”— Related Issue

⌨️ What I did

  • Set와 Mapμ—μ„œμ˜ get λͺ…λ Ή DFS 탐색 μˆœμ„œλ₯Ό λ³€κ²½ν–ˆμŠ΅λ‹ˆλ‹€.
    • κΈ°μ‘΄ 방법: λͺ¨λ“  ν•΄μ‹œ ν…Œμ΄λΈ”μ„ μš°μ„  νƒμƒ‰ν•œ λ’€ element 체인을 탐색
    • λ³€κ²½ 방법: ν•΄μ‹œ ν…Œμ΄λΈ”μ˜ 인덱슀 μˆœμ„œμ— 따라 탐색

@jeesup0103 jeesup0103 marked this pull request as ready for review January 3, 2025 08:05
@namsic namsic self-requested a review January 3, 2025 08:15
Copy link
Collaborator

@namsic namsic left a comment

Choose a reason for hiding this comment

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

coll_map.c에 μ•„λž˜μ™€ 같은 ν•¨μˆ˜κ°€ 있고, do_set_elem_traverse_dfs()와 μœ μ‚¬ν•œ ν˜•νƒœλ₯Ό κ°–κ³  μžˆμŠ΅λ‹ˆλ‹€.

static int do_map_elem_traverse_dfs_bycnt(map_meta_info *info, map_hash_node *node,
                                          const uint32_t count, const bool delete,
                                          map_elem_item **elem_array, enum elem_delete_cause cause)

λ™μΌν•œ λ³€κ²½ 적용이 ν•„μš”ν•œμ§€ 확인해쀄 수 μžˆλ‚˜μš”?

engines/default/coll_set.c Outdated Show resolved Hide resolved
@jeesup0103
Copy link
Author

@namsic

coll_map.c에 μ•„λž˜μ™€ 같은 ν•¨μˆ˜κ°€ 있고, do_set_elem_traverse_dfs()와 μœ μ‚¬ν•œ ν˜•νƒœλ₯Ό κ°–κ³  μžˆμŠ΅λ‹ˆλ‹€.

static int do_map_elem_traverse_dfs_bycnt(map_meta_info *info, map_hash_node *node,
                                          const uint32_t count, const bool delete,
                                          map_elem_item **elem_array, enum elem_delete_cause cause)

λ™μΌν•œ λ³€κ²½ 적용이 ν•„μš”ν•œμ§€ 확인해쀄 수 μžˆλ‚˜μš”?

map도 기쑴의 setκ³Ό λ™μΌν•œ λ…Όλ¦¬λ‘œ dfsλ₯Ό μ§„ν–‰ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.
탐색 μˆœμ„œλ₯Ό hash table의 index μˆœμ„œμ— 따라 μ§„ν–‰ν•˜λ„λ‘ μˆ˜μ •ν•˜λŠ” 것이 μ’‹μ•„λ³΄μž…λ‹ˆλ‹€.

@namsic
Copy link
Collaborator

namsic commented Jan 6, 2025

@jeesup0103
map도 기쑴의 setκ³Ό λ™μΌν•œ λ…Όλ¦¬λ‘œ dfsλ₯Ό μ§„ν–‰ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.
탐색 μˆœμ„œλ₯Ό hash table의 index μˆœμ„œμ— 따라 μ§„ν–‰ν•˜λ„λ‘ μˆ˜μ •ν•˜λŠ” 것이 μ’‹μ•„λ³΄μž…λ‹ˆλ‹€.

같은 μ„±κ²©μ˜ λ³€κ²½μ΄λ―€λ‘œ, map의 dfs에 λŒ€ν•΄μ„œλ„ ν•˜λ‚˜μ˜ PR둜 μ²˜λ¦¬ν•˜λ©΄ μ’‹κ² μŠ΅λ‹ˆλ‹€.

μ°Έκ³ μ‚¬ν•­μœΌλ‘œ, map은 field λ‹¨μœ„λ‘œ μ‘°νšŒν•˜λ―€λ‘œ count개의 elementλ₯Ό μ‘°νšŒν•˜λŠ” APIλŠ” μ—†μ§€λ§Œ,
λͺ¨λ“  field 탐색, reclaim λ“±μ˜ λ™μž‘ μˆ˜ν–‰ 쀑에 do_map_elem_traverse_dfs_bycnt() ν•¨μˆ˜κ°€ 호좜될 수 μžˆμŠ΅λ‹ˆλ‹€.

@jeesup0103 jeesup0103 requested a review from namsic January 6, 2025 06:02
@jeesup0103 jeesup0103 changed the title INTERNAL: Change DFS traverse order in set INTERNAL: Change DFS traverse order in set and map Jan 6, 2025
Copy link
Collaborator

@namsic namsic left a comment

Choose a reason for hiding this comment

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

commit message에도 λ§ˆμ§€λ§‰μ— and map μΆ”κ°€ν•˜λ©΄ μ’‹κ² μŠ΅λ‹ˆλ‹€.

@namsic namsic requested a review from jhpark816 January 6, 2025 10:44
@namsic
Copy link
Collaborator

namsic commented Jan 7, 2025

μΆ”κ°€) commit author에 jam2in μ œκ±°ν•΄ μ£Όμ„Έμš”.

}
if (count > 0 && fcnt >= count) break;
Copy link
Collaborator

Choose a reason for hiding this comment

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

μ§ˆλ¬Έμž…λ‹ˆλ‹€.
node->hcnt[hidx] == 0인 κ²½μš°μ—λ„ if λ¬Έμž₯이 μˆ˜ν–‰λ˜κ²Œ ν•œ 것이 μ˜λ„ν•œ 것이죠?

Copy link
Author

Choose a reason for hiding this comment

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

node->hcnt[hidx] == 0인 κ²½μš°μ—λ„ if λ¬Έμž₯이 μˆ˜ν–‰λ˜κ²Œ ν•œ 것이 μ˜λ„ν•œ 것이죠?

λ„€. fnct 값이 λ³€ν•΄μ„œ break κ°€ μΌμ–΄λ‚˜λŠ” κ²½μš°λŠ” node->hcnt[hidx] > 0 λ˜λŠ” node->hcnt[hidx] == -1 μƒν™©μ—μ„œ μΌμ–΄λ‚˜κΈ° λ•Œλ¬Έμ— node->hcnt[hidx] == 0 인 κ²½μš°μ—λŠ” if 문이 μ‹€ν–‰λ˜μ–΄λ„ λ„˜μ–΄κ°‘λ‹ˆλ‹€.

@jhpark816 jhpark816 merged commit c3340cb into naver:develop Jan 7, 2025
1 check passed
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.

3 participants