Changeset c82e4ca for unix.c


Ignore:
Timestamp:
2018-07-31T03:40:26Z (18 months ago)
Author:
dx <dx@…>
Branches:
master
Children:
921ea8b, f7cc734
Parents:
5c90890
git-author:
dequis <dx@…> (12-07-18 08:30:59)
git-committer:
dx <dx@…> (31-07-18 03:40:26)
Message:

Use GString for irc->sendbuffer (simpler and faster)

The old code managed growing the buffer manually and called strlen()
very often. GString has a length field and the logic to grow the buffer
is none of our business. Probably smarter, too.

This takes a "blist all" of 14k users from 8.2 to 1.3 seconds.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • unix.c

    r5c90890 rc82e4ca  
    373373                sock_make_blocking(irc->fd);
    374374                if (irc->sendbuffer) {
    375                         (void) write(irc->fd, irc->sendbuffer, strlen(irc->sendbuffer));
     375                        (void) write(irc->fd, irc->sendbuffer->str, irc->sendbuffer->len);
    376376                }
    377377                (void) write(irc->fd, message, sizeof(message) - 1);
Note: See TracChangeset for help on using the changeset viewer.