same problem , version 2
- Posted by useless Aug 29, 2009
- 1039 views
Re the topic "same problem in v4 as previous editions" , i just could not leave the application alone. The issue besides the files crashing if edited was that it took so long for news.ex to even launch the wget.ex (or wget.exe), and i usually had changes in mind already for the next run. Ok, if i can't fix the crashing problem myself (except with system(attrib +r etc, but i assume Matt may work on that), i went on to fix the problem from another angle, that it took so long to get the treads running. It seriously peeved me that the 3rd task was starting at the time the 1st one was done, and zero work was being done on the 1st's task's results.
One thing led to another, resulting in speedup mods to http.e and a news2.ex and a news3.ex. Turns out the major problem wasn't due to task overhead at all.
Http.e now tries to be non-blocking in recieving data in get_http() (typically called thru get_url()) and part of that is task_yield.
News.ex uses system() to launch new external apps, the link below can use gnu.org's wget.exe or Euphoria's wget.ex (which calls http.e), both as external applications which pass their results back in temporary disk files. This was like a train wreck of blocking calls, and slowest possible methods of doing things. I also feared it could come to a dead stop once the number of permitted open disk files got consumed. But the tasking code worked, even if there was too much of it. If you want to see how to do what it does, study it. Disk files are one of the ways to share data between apps on windoze, and new.ex shows an easy way to use tasks to monitor when the file(s) are ready to be read, without stalling your reading app.
News2.ex no longer has any system() calls, which are blocking, regardless of if they are in a task or not, once system() is called, the main task issuing loop cannot continue running, launch new tasks, or yield until system() returns. It uses the newer and improveder http.e as an include. I severely trimmed the tasks calls in it compared to news.e, and it runs ~5x faster. News2.ex has a display that makes sure you know it's multitasking.
News3.ex is a speed improvement on news2.ex, with a more plain display, altho the results are still shown in real time. By optomising for Eu v4's built-in routines, i could remove more tasking calls with no speed hits, and gained speed instead. It's how you'd code if you want speed instead of flashy gui display. Of course, for even more speed, comment out all prints/puts and all calls to console.e.
I put the files up on my host to promote the use of Eu v4 tasks functions in any new code. Any multiuser or realtime internet code could use v4's tasks code, and likely Ai and games code. It is non-preemtive tasking, but it's sometimes hard to say which task method is best. In v4's way, the programmer of the application has most control over how their application is running.
The files are at news.ex , news2.ex , news3.ex , and you'll need this http.e for it's attempts at non-blocking sockets on win32.
Have funs, people!
Comments accepted from most people.
useless