### Question:
ThriftSerializer { public <T extends TBase<T, ?>> byte[] toByte(T data) throws ThriftSerializeException { Objects.requireNonNull(data, "data"); try { TSerializer serializer = serializerPool.borrowObject(); try { byte[] bytes = serializer.serialize(data); if (bytes.length >= maxFrameSize) { throw new ThriftTooLongMessageException( "Unable to write object " + data.getClass().getName() + ", it's too big. Size: " + bytes.length ); } return bytes; } finally { try { serializerPool.returnObject(serializer); } catch (Exception ex) { log.error("Unable to return object to pool", ex); } } } catch (ThriftTooLongMessageException e) { throw e; } catch (Exception e) { throw new ThriftSerializeException("Unable to serialize " + data.getClass().getName(), e); } } ThriftSerializer();  ThriftSerializer(long maxFrameSize); static Constructor<T> getConstructor(Class<T> objectClass); T fromBytes(Class<T> clazz, byte[] data); byte[] toByte(T data); static final int DEFAULT_MAX_FRAME_SIZE; }### Answer:
@Test(groups = "unit") public void toBytes() throws Exception { ExecutorService executor = Executors.newFixedThreadPool(16); for (int i = 0; i < 5000; i++) { serializer.toByte(mapResult); } try { final int COUNT = 30_000; long start = System.nanoTime(); for (int i = 0; i < COUNT; i++) { long id = i; executor.execute(() -> serializer.toByte(mapResult)); } executor.shutdown(); if (!executor.awaitTermination(1, TimeUnit.MINUTES)){ fail("Unable to complete test"); } long time = System.nanoTime() - start; System.out.println("toBytes Exec time (sec): " + (time / 1_000_000_000d)); System.out.println("toBytes Rps: " + COUNT / (time / 1_000_000_000d)); } finally { executor.shutdown(); } }