Ticket #2637 (closed enhancement: fixed)

Opened 5 years ago

Last modified 5 years ago

Faster startup for mc-4.8

Reported by: 0xe2.0x9a.0x9b Owned by: andrew_b
Priority: major Milestone: 4.8.1
Component: mc-core Version: 4.8.0
Keywords: Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master committed-stable

Description

A patch that reduces startup time by 30%.

Attachments

mc-4.8.0-fasterStartup.diff (22.0 KB) - added by 0xe2.0x9a.0x9b 5 years ago.

Change History

Changed 5 years ago by 0xe2.0x9a.0x9b

comment:1 Changed 5 years ago by andrew_b

str_create_search_needle() just does nothing in 7-bit and 8-bit locales. In utf-8 locale, str_utf8_create_search_needle() performs additional actions. Since name is ASCII-only, there is no need to call str_utf8_create_search_needle() in utf-8 locales.

Where do you see an optimization?

Last edited 5 years ago by andrew_b (previous) (diff)

comment:2 follow-up: ↓ 3 Changed 5 years ago by 0xe2.0x9a.0x9b

The optimization is that 'strcmp' is used instead of 'str_casecmp'.

comment:3 in reply to: ↑ 2 ; follow-up: ↓ 4 Changed 5 years ago by andrew_b

  • Status changed from new to accepted
  • Owner set to andrew_b
  • Branch state changed from no branch to on review

Replying to 0xe2.0x9a.0x9b:

The optimization is that 'strcmp' is used instead of 'str_casecmp'.

OK. What about simple replace str_casecmp with g_ascii_strcasecmp, because of content of keymap file is ASCII-only and case insensitive?

Created 2637_faster_startup branch (parent: master).
Initial changeset:5714bcbcc23a9c69a8af74f648797553ffcedec2

The 2nd commit in the branch optimizes creation of menu: reduce number of GList iterations.

Please review and test.

comment:4 in reply to: ↑ 3 ; follow-up: ↓ 5 Changed 5 years ago by 0xe2.0x9a.0x9b

Replying to andrew_b:

Created 2637_faster_startup branch (parent: master).
Initial changeset:5714bcbcc23a9c69a8af74f648797553ffcedec2

The 2nd commit in the branch optimizes creation of menu: reduce number of GList iterations.

  • The version with g_ascii_strcasecmp runs as fast as my own patch. If you are sure that in the future those strings will stay ASCII, I would recommend to use g_ascii_strcasecmp instead of my patch.
  • I don't see how g_list_append can be a bottleneck. You benchmarked it (valgrind) and g_list_append was a hotspot, so you had to optimize it?

comment:5 in reply to: ↑ 4 Changed 5 years ago by andrew_b

Replying to 0xe2.0x9a.0x9b:

  • The version with g_ascii_strcasecmp runs as fast as my own patch. If you are sure that in the future those strings will stay ASCII, I would recommend to use g_ascii_strcasecmp instead of my patch.

Since language-specific hotkeys are not supported (#2343), it will be a long time. I think, till next major release.

  • I don't see how g_list_append can be a bottleneck. You benchmarked it (valgrind) and g_list_append was a hotspot, so you had to optimize it?

g_list_append is not a bottleneck actually, but it should be optimized anyway.

comment:6 Changed 5 years ago by slavazanko

  • Votes for changeset set to slavazanko

comment:7 Changed 5 years ago by angel_il

  • Votes for changeset changed from slavazanko to slavazanko angel_il
  • Branch state changed from on review to approved

comment:8 Changed 5 years ago by andrew_b

  • Status changed from accepted to testing
  • Votes for changeset changed from slavazanko angel_il to committed-master committed-stable
  • Resolution set to fixed
  • Branch state changed from approved to merged

Merged to master.
changeset:cea7ebf727494be01396a64f36ced9a972b65b8f

git log --pretty=oneline 0035a1d..cea7ebf

Cherry-picked to 4.7.5-stable.
Initial changeset:fb13e0d143740ef65690b6a0f91d2d02f859e7e5

comment:9 Changed 5 years ago by andrew_b

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.