Skip to content
  • Benjamin Otte's avatar
    Use the faster accessor function in the sort functions · d68bca17
    Benjamin Otte authored
    Use the faster _gtk_file_system_model_get_value() function instead of
    gtk_tree_model_get() inside the sort functions. This gives a significant
    speed-up when sorting large lists.
    In a test case with 40.000 files, the sorting time went from ~5 seconds
    to less than 0.5 seconds for my test case. There is 2 significant
    problems with gtk_tree_model_get() that cause this:
    1) The value is copied, which takes quite a bit of time for strings.
       ~25% of excessive time or ~1 second in my test
    2) The tree model functions need to lookup the interface vfunc. And
       gtk_tree_model_get() doesn't do that only once, but multiple times
       (verifying column id, getting the actual value, ...)
       ~75% of excessive time or ~3 seconds in my test
    d68bca17