Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Is the problem that it takes a long time to parse the XML, or is the problem that your code sits around waiting for e.g. HTTP requests to return?

It is possible to create nonblocking sockets in PHP, though things might get a tad complicated.It is possible to create nonblocking sockets in PHP, though things might get a tad complicated.

If you have expat installed, you can also set up event handlers to react to elements as they are parsed, which complements an asynchronous read very nicely.

Perhaps you can delegate this task to another process/service developed in a language that supports asynchronous operations. It won't guarantee a speedup (you still have to wait for both HTTP requests to return), but at least you can start working on data as they come in rather than wait until you've received all the data before starting to process.

Note that this is distinct from the second half of tdammers's answer. This answer focuses on keeping the retrieval and processing of the XML at "request time" (necessary when the data in the XML files change frequently and/or the data has to be "real time"), whereas tdammers's answer focuses on keeping the data in a cache (offers much better performance when the data don't change that often and/or if "stale" data are acceptable).

Is the problem that it takes a long time to parse the XML, or is the problem that your code sits around waiting for e.g. HTTP requests to return?

It is possible to create nonblocking sockets in PHP, though things might get a tad complicated.

If you have expat installed, you can also set up event handlers to react to elements as they are parsed, which complements an asynchronous read very nicely.

Perhaps you can delegate this task to another process/service developed in a language that supports asynchronous operations. It won't guarantee a speedup (you still have to wait for both HTTP requests to return), but at least you can start working on data as they come in rather than wait until you've received all the data before starting to process.

Note that this is distinct from the second half of tdammers's answer. This answer focuses on keeping the retrieval and processing of the XML at "request time" (necessary when the data in the XML files change frequently and/or the data has to be "real time"), whereas tdammers's answer focuses on keeping the data in a cache (offers much better performance when the data don't change that often and/or if "stale" data are acceptable).

Is the problem that it takes a long time to parse the XML, or is the problem that your code sits around waiting for e.g. HTTP requests to return?

It is possible to create nonblocking sockets in PHP, though things might get a tad complicated.

If you have expat installed, you can also set up event handlers to react to elements as they are parsed, which complements an asynchronous read very nicely.

Perhaps you can delegate this task to another process/service developed in a language that supports asynchronous operations. It won't guarantee a speedup (you still have to wait for both HTTP requests to return), but at least you can start working on data as they come in rather than wait until you've received all the data before starting to process.

Note that this is distinct from the second half of tdammers's answer. This answer focuses on keeping the retrieval and processing of the XML at "request time" (necessary when the data in the XML files change frequently and/or the data has to be "real time"), whereas tdammers's answer focuses on keeping the data in a cache (offers much better performance when the data don't change that often and/or if "stale" data are acceptable).

replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/
Source Link

Is the problem that it takes a long time to parse the XML, or is the problem that your code sits around waiting for e.g. HTTP requests to return?

It is possible to create nonblocking sockets in PHP, though things might get a tad complicated.

If you have expat installed, you can also set up event handlers to react to elements as they are parsed, which complements an asynchronous read very nicely.

Perhaps you can delegate this task to another process/service developed in a language that supports asynchronous operations. It won't guarantee a speedup (you still have to wait for both HTTP requests to return), but at least you can start working on data as they come in rather than wait until you've received all the data before starting to process.

Note that this is distinct from the second half of tdammers's answersecond half of tdammers's answer. This answer focuses on keeping the retrieval and processing of the XML at "request time" (necessary when the data in the XML files change frequently and/or the data has to be "real time"), whereas tdammers's answer focuses on keeping the data in a cache (offers much better performance when the data don't change that often and/or if "stale" data are acceptable).

Is the problem that it takes a long time to parse the XML, or is the problem that your code sits around waiting for e.g. HTTP requests to return?

It is possible to create nonblocking sockets in PHP, though things might get a tad complicated.

If you have expat installed, you can also set up event handlers to react to elements as they are parsed, which complements an asynchronous read very nicely.

Perhaps you can delegate this task to another process/service developed in a language that supports asynchronous operations. It won't guarantee a speedup (you still have to wait for both HTTP requests to return), but at least you can start working on data as they come in rather than wait until you've received all the data before starting to process.

Note that this is distinct from the second half of tdammers's answer. This answer focuses on keeping the retrieval and processing of the XML at "request time" (necessary when the data in the XML files change frequently and/or the data has to be "real time"), whereas tdammers's answer focuses on keeping the data in a cache (offers much better performance when the data don't change that often and/or if "stale" data are acceptable).

Is the problem that it takes a long time to parse the XML, or is the problem that your code sits around waiting for e.g. HTTP requests to return?

It is possible to create nonblocking sockets in PHP, though things might get a tad complicated.

If you have expat installed, you can also set up event handlers to react to elements as they are parsed, which complements an asynchronous read very nicely.

Perhaps you can delegate this task to another process/service developed in a language that supports asynchronous operations. It won't guarantee a speedup (you still have to wait for both HTTP requests to return), but at least you can start working on data as they come in rather than wait until you've received all the data before starting to process.

Note that this is distinct from the second half of tdammers's answer. This answer focuses on keeping the retrieval and processing of the XML at "request time" (necessary when the data in the XML files change frequently and/or the data has to be "real time"), whereas tdammers's answer focuses on keeping the data in a cache (offers much better performance when the data don't change that often and/or if "stale" data are acceptable).

Added pros/cons comparing similar answers.
Source Link
user34530
user34530

Is the problem that it takes a long time to parse the XML, or is the problem that your code sits around waiting for e.g. HTTP requests to return?

It is possible to create nonblocking sockets in PHP, though things might get a tad complicated.

If you have expat installed, you can also set up event handlers to react to elements as they are parsed, which complements an asynchronous read very nicely.

Perhaps you can delegate this task to another process/service developed in a language that supports asynchronous operations. It won't guarantee a speedup (you still have to wait for both HTTP requests to return), but at least you can start working on data as they come in rather than wait until you've received all the data before starting to process.

Note that this is distinct from the second half of tdammers's answer. This answer focuses on keeping the retrieval and processing of the XML at "request time" (necessary when the data in the XML files change frequently and/or the data has to be "real time"), whereas tdammers's answer focuses on keeping the data in a cache (offers much better performance when the data don't change that often and/or if "stale" data are acceptable).

Is the problem that it takes a long time to parse the XML, or is the problem that your code sits around waiting for e.g. HTTP requests to return?

It is possible to create nonblocking sockets in PHP, though things might get a tad complicated.

If you have expat installed, you can also set up event handlers to react to elements as they are parsed, which complements an asynchronous read very nicely.

Perhaps you can delegate this task to another process/service developed in a language that supports asynchronous operations. It won't guarantee a speedup (you still have to wait for both HTTP requests to return), but at least you can start working on data as they come in rather than wait until you've received all the data before starting to process.

Note that this is distinct from the second half of tdammers's answer. This answer focuses on keeping the retrieval and processing of the XML at "request time", whereas tdammers's answer focuses on keeping the data in a cache.

Is the problem that it takes a long time to parse the XML, or is the problem that your code sits around waiting for e.g. HTTP requests to return?

It is possible to create nonblocking sockets in PHP, though things might get a tad complicated.

If you have expat installed, you can also set up event handlers to react to elements as they are parsed, which complements an asynchronous read very nicely.

Perhaps you can delegate this task to another process/service developed in a language that supports asynchronous operations. It won't guarantee a speedup (you still have to wait for both HTTP requests to return), but at least you can start working on data as they come in rather than wait until you've received all the data before starting to process.

Note that this is distinct from the second half of tdammers's answer. This answer focuses on keeping the retrieval and processing of the XML at "request time" (necessary when the data in the XML files change frequently and/or the data has to be "real time"), whereas tdammers's answer focuses on keeping the data in a cache (offers much better performance when the data don't change that often and/or if "stale" data are acceptable).

Added expat install info, added credit to tdammers for posting his answer first.
Source Link
user34530
user34530
Loading
Added expat install info, added credit to tdammers for posting his answer first.
Source Link
user34530
user34530
Loading
Source Link
user34530
user34530
Loading