[geany/geany] cb9e4b: Microoptimization in merge

Jiří Techet git-noreply at xxxxx
Thu Oct 30 21:08:17 UTC 2014


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Thu, 30 Oct 2014 21:08:17 UTC
Commit:      cb9e4bbf7446e45365cad2242087f2a766662f20
             https://github.com/geany/geany/commit/cb9e4bbf7446e45365cad2242087f2a766662f20

Log Message:
-----------
Microoptimization in merge

Improves performance by about 10%.


Modified Paths:
--------------
    tagmanager/src/tm_tag.c

Modified: tagmanager/src/tm_tag.c
4 lines changed, 3 insertions(+), 1 deletions(-)
===================================================================
@@ -899,7 +899,9 @@ static GPtrArray *merge(GPtrArray *big_array, GPtrArray *small_array,
 				while (i1 <= j1) 
 				{
 					val1 = big_array->pdata[i1];
-					g_ptr_array_add(res_array, val1);
+					/* we allocated enough space so we are sure we don't need to reallocate
+					 * the array - copy and increment the size directly so it can be inlined */
+					res_array->pdata[res_array->len++] = val1;
 					i1++;
 				}
 			}



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list