<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39558 >

On Mon, Aug 13, 2007 at 03:58:01PM -0700, William Allen Simpson wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=39558 >
> Michael Kaufman wrote:
> > are you sure? inventions is boolean, so if memory serves [it usually
> > doesn't; I don't have the packet handling code in front of me] BIT_STRING 
> > is going to give you a packet which is ~175 bytes smaller...
> > 
> Inventions are trinary.

sorry, yes inventions are technically trinary, but for purposes of passing
to the client, they're binary, since update_research() is called upon
receiving a player_info packet.

> And the code seems willing to send 250KB of attributes without blinking,
> but now you're worrying about compression of 175 bytes?  Heck, shouldn't
> even be 175 bytes, as there are only 87 inventions....

Do not get me started on attributes. The faster they die a horrible death,
the better we will all feel (except maybe Raimar), but that's beside the
point. You've got bit data. Do the right thing and send it as a bit string
like the code was written to do. Also the attribute send happens very
rarely --- just player connect? --- but player_info packets get sent a lot
(though I grant, the INFO_EMBASSY check removes the inventions [bit]string
most of the time).
> The smarter course would be to send strings with lengths (maybe it does).

yes it does:

    for (i = A_FIRST; i < game.control.num_tech_types; i++) {
      packet->inventions[i] = '0';

and dio_put_bit_string() uses strlen()

> Let's stick to worrying about packets that are more than 1500 bytes, as
> those might cause fragmentation and collisions.

I've heard the bit about premature optimization, but in this case, you're
going backward.


Freeciv-dev mailing list

Reply via email to