0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 18:18:56 +02:00

ircd: Reduce the size of the lex_cast ringbuffer; deinline the sizes.

This commit is contained in:
Jason Volk 2019-03-01 11:47:13 -08:00
parent 70a47c98b1
commit 56d0292305
2 changed files with 14 additions and 5 deletions

View file

@ -29,7 +29,8 @@ namespace ircd
template<class T> string_view lex_cast(T, const mutable_buffer &buf);
// Circular static thread_local buffer
const size_t LEX_CAST_BUFS {256}; // plenty
extern const size_t LEX_CAST_BUFS;
extern const size_t LEX_CAST_BUFSIZE;
template<class T> string_view lex_cast(const T &t);
}

View file

@ -18,12 +18,20 @@
#include <boost/lexical_cast.hpp>
decltype(ircd::LEX_CAST_BUFS)
ircd::LEX_CAST_BUFS
{
64 // plenty
};
decltype(ircd::LEX_CAST_BUFSIZE)
ircd::LEX_CAST_BUFSIZE
{
64
};
namespace ircd
{
/// The static lex_cast ring buffers are each LEX_CAST_BUFSIZE bytes;
/// Consider increasing if some lex_cast<T>(str) has more characters.
const size_t LEX_CAST_BUFSIZE {64};
/// This is a static "ring buffer" to simplify a majority of lex_cast uses.
/// If the lex_cast has binary input and string output, and no user buffer
/// is supplied, the next buffer here will be used instead. The returned