[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#6734: "inline" overused in .c files?
From: |
Paul Eggert |
Subject: |
bug#6734: "inline" overused in .c files? |
Date: |
Mon, 26 Jul 2010 18:45:12 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.10) Gecko/20100527 Thunderbird/3.0.5 |
After Bruno's comments it seems that some typical compilers
can benefit from "inline" on some functions, particularly small and
commonly used functions, so I removed just the "inline"s that didn't
appear like they would help measurably on any typical platform.
>From 66e934b61f05ef32583df2a33f371c768b79c452 Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Mon, 26 Jul 2010 18:38:19 -0700
Subject: [PATCH] sort: omit some "inline"s
* src/sort.c (mergelines, queue_destroy, queue_init, queue_insert):
(queue_pop, write_unique, mergelines_node, check_insert):
(update_parent): No longer inline; these uses of "inline"
seemed unlikely to help performance much.
---
src/sort.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/sort.c b/src/sort.c
index 1fd4ce7..2ee5a1d 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -3007,7 +3007,7 @@ mergefiles (struct sortfile *files, size_t ntemps, size_t
nfiles,
T and LO point just past their respective arrays, and the arrays
are in reverse order. NLINES must be at least 2. */
-static inline void
+static void
mergelines (struct line *restrict t, size_t nlines,
struct line const *restrict lo)
{
@@ -3138,7 +3138,7 @@ unlock_node (struct merge_node *node)
/* Destroy merge QUEUE. */
-static inline void
+static void
queue_destroy (struct merge_node_queue *queue)
{
heap_free (queue->priority_queue);
@@ -3151,7 +3151,7 @@ queue_destroy (struct merge_node_queue *queue)
RESERVE should accommodate all of them. Counting a NULL dummy head for the
heap, RESERVE should be 2 * NTHREADS. */
-static inline void
+static void
queue_init (struct merge_node_queue *queue, size_t reserve)
{
queue->priority_queue = heap_alloc (compare_nodes, reserve);
@@ -3162,7 +3162,7 @@ queue_init (struct merge_node_queue *queue, size_t
reserve)
/* Insert NODE into priority QUEUE. Assume caller either holds lock on NODE
or does not need to lock NODE. */
-static inline void
+static void
queue_insert (struct merge_node_queue *queue, struct merge_node *node)
{
pthread_mutex_lock (&queue->mutex);
@@ -3174,7 +3174,7 @@ queue_insert (struct merge_node_queue *queue, struct
merge_node *node)
/* Pop NODE off priority QUEUE. Guarantee a non-null, spinlocked NODE. */
-static inline struct merge_node *
+static struct merge_node *
queue_pop (struct merge_node_queue *queue)
{
struct merge_node *node;
@@ -3192,7 +3192,7 @@ queue_pop (struct merge_node_queue *queue)
this function does not actually save the line, nor any key information,
thus is only appropriate for internal sort. */
-static inline void
+static void
write_unique (struct line const *line, FILE *tfp, char const *temp_output)
{
static struct line const *saved = NULL;
@@ -3209,7 +3209,7 @@ write_unique (struct line const *line, FILE *tfp, char
const *temp_output)
/* Merge the lines currently available to a NODE in the binary
merge tree, up to a maximum specified by MAX_MERGE. */
-static inline size_t
+static size_t
mergelines_node (struct merge_node *restrict node, size_t total_lines,
FILE *tfp, char const *temp_output)
{
@@ -3276,7 +3276,7 @@ mergelines_node (struct merge_node *restrict node, size_t
total_lines,
/* Insert NODE into QUEUE if it passes insertion checks. */
-static inline void
+static void
check_insert (struct merge_node *node, struct merge_node_queue *queue)
{
size_t lo_avail = node->lo - node->end_lo;
@@ -3296,7 +3296,7 @@ check_insert (struct merge_node *node, struct
merge_node_queue *queue)
/* Update parent merge tree NODE. */
-static inline void
+static void
update_parent (struct merge_node *node, size_t merged,
struct merge_node_queue *queue)
{
--
1.7.2