git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] merge-recursive: replace string_list with hashmap
@ 2017-09-07 16:25 Kevin Willford
  2017-09-07 16:25 ` [PATCH v3 1/3] merge-recursive: fix memory leak Kevin Willford
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kevin Willford @ 2017-09-07 16:25 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Kevin Willford

Code was using two string_lists, one for the directories and
one for the files.  The code never checks the lists independently
so we should be able to only use one list.  The string_list also
is a O(log n) for lookup and insertion.  Switching this to use a
hashmap will give O(1) which will save some time when there are
millions of paths that will be checked.

Also cleaned up a memory leak and method where the return was not
being used.

Changes since last version:
1. Removed the function pointers and just check the ignore_case in the
compare and hash methods.
2. Added a comment about the hashmap and why it is getting initialized
and freed but not a local.
3. Use hashmap_get_from_hash and remove the dummy entry

Kevin Willford (3):
  merge-recursive: fix memory leak
  merge-recursive: remove return value from get_files_dirs
  merge-recursive: change current file dir string_lists to hashmap

 merge-recursive.c | 76 ++++++++++++++++++++++++++++++++++++++++---------------
 merge-recursive.h |  3 +--
 2 files changed, 57 insertions(+), 22 deletions(-)

-- 
2.14.1.329.gcdd497e120.dirty


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-07 16:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-07 16:25 [PATCH v3 0/3] merge-recursive: replace string_list with hashmap Kevin Willford
2017-09-07 16:25 ` [PATCH v3 1/3] merge-recursive: fix memory leak Kevin Willford
2017-09-07 16:25 ` [PATCH v3 2/3] merge-recursive: remove return value from get_files_dirs Kevin Willford
2017-09-07 16:25 ` [PATCH v3 3/3] merge-recursive: change current file dir string_lists to hashmap Kevin Willford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).