T
T
Thegaar2015-11-27 16:02:12
PHP
Thegaar, 2015-11-27 16:02:12

How to quickly process a heavy array?

Guys such a problem. There is a file of 50k+ records (users). Records in json format (Lie in the file). I parse json, upload users through the engine api. API function like user->add(user_info_array). That is, 1 user is added. How can I quickly process the data and add all users? One cycle did - put the base.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Shamanov, 2015-11-27
@SilenceOfWinter

If the procedure is one-time, then it is easier to do it on the local machine by unscrewing the settings to the maximum.

S
Stalker_RED, 2015-11-27
@Stalker_RED

If there is a LOT of data, then you can upload it from a file: LOAD DATA INFILE . Or via mysqlimport .
50k - not so much, you can really beat in pieces of 1000 pieces, for example, as Sergei advised

A
asd111, 2015-11-27
@asd111

In the loop after user->add(user_info_array) try putting usleep(10000) - wait 0.01 seconds

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question