RE: CLI spinner processing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Per Jessen [mailto:per@xxxxxxxxxxxx] 
> Sent: Wednesday, November 14, 2007 1:08 AM
> 
> Daevid Vincent wrote:
> 
> > I am importing millions of records, and didn't want to 
> waste CPU time on  computing modulus on some huge $i value. :)
> 
> So instead you spend it on displaying a progress indicator :-)

HA!

Actually yes. But allow me to retort my whimsical friend who is so quick to sneer. ;-p

Because I wanted some way to know that each of the millions of records was being imported. A "progress indicator" if you will. One that quickly illustrates that "yes, something is still churning away, even though it might be taking minutes, hours or *gasp* days to process".

I didn't want to print out a single "." for each one, as that still just takes up pages and pages of scrolling as they whiz by. 

I didn't want to use the new record ID, as that takes up a wasted SQL call to get LAST_INSERT_ID(). 

So a spinner was a likely candidate. It sits in place and rotates 1/8 turn for each record inserted. As errors occur, I can spit them out where I'm sure to see them (or log them to an error log) and they won't get lost in a maxed out scroll-back buffer.

Plus it looks freakin' slick as hell and gives the appearance that I am smarter than I am. *grin*

> besides, modulus 8 is done by one single instruction - of 
> which a modern processor does some three billion per second. 

Perhaps. But I prefer to write optimized code. I am used to it from when I used to code 3D games, where every microsecond you can shave counts. Even now, as I design LAMP tools, at the enterprise level, when you shave off a few microseconds from each iteration, and multiply that times large datasets, you quickly start to shave off seconds from every page load. It matters.  I believe that if MORE people thought this way, then there would be less bloated software.

How come it is that with all those three billion instructions per second I *STILL* have to wait for ANYTHING to do ANYTHING? Seems to me it should be instantaneous... Food for thought.

P.L.U.R.  (nice domain name btw. :) )

D.Vin
http://daevid.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux