Getting large amount of data

JesseDJesseD Member Posts: 1
edited February 2019 in web3-js
Hello !

I'm new on etheurem / solidity : web3 developpement and I have a performance issue.

I need to retrieve multiple struct variable, so I use the native getter to get one data in my mapping but when there is like 20 data in the mapping, the getter is very slow.

Here a preview of my code :

Web3 part :
for (var i = 1; i <= requestsCount.toNumber(); i++) {

        var request = await App.deliveryInstance.requests(i); // This line is very slow
Solidity :
struct Request{
		uint id;
		string productName;
		string addressFrom;
		string addressTo;
		string state;
mapping(uint => Request) public requests;
	uint public requestsCount;

Do you know how can I get the data more quickly (or do you know why is this so slow?)

Thanks a lot for advices !
Post edited by JesseD on
Sign In or Register to comment.