hyperledger / web3j

Lightweight Java and Android library for integration with Ethereum clients
https://www.web3labs.com/web3j-sdk
Other
5.07k stars 1.68k forks source link

about Flowable Performance problems #1787

Open Alamu-Eth opened 1 year ago

Alamu-Eth commented 1 year ago

org.web3j.protocol.rx.JsonRpc2_0Rx#pendingTransactionFlowable When a large amount of data is traded, use flatMap will be delays.

**public Flowable<Transaction> pendingTransactionFlowable(long pollingInterval) {
    return this.ethPendingTransactionHashFlowable(pollingInterval).flatMap((transactionHash) -> {
        return this.web3j.ethGetTransactionByHash(transactionHash).flowable();
    }).filter((ethTransaction) -> {
        return ethTransaction.getTransaction().isPresent();
    }).map((ethTransaction) -> {
        return (Transaction)ethTransaction.getTransaction().get();
    });
}**
mohamedelshami commented 1 year ago

hi @youzhang0413

Thanks for pointing this out, can you please provide more details on the size of the data sample and the time it takes to process? I presume the flatMap has been identified as a bottleneck after benchmarking with a profiler?