Wow.  Very dramatic improvement.

On Apr 28, 2006, at 8:34 AM, Robert Garcia wrote:

Here is a test, if interested.

http://devws.bighead.net/test/servethumb.taf

First method, unhinted PHP-GD library - 15 seconds to do 10 thumbs of 6mp image to 150x150, about normal

Second method, hinted PHP doing convert from the commandline < 2000ms for 10 thumbs.

Third method, witango using witangomagick bean thumbfile2blob method < 2000ms.

PHP doesn't seem to suffer from calling a external command. When I get the javabridge on that server I will see if php/bean is any better. But this shows how fast these methods can be, even in witango when using bean.

--

Robert Garcia
President - BigHead Technology
VP Application Development - eventpix.com
13653 West Park Dr
Magalia, Ca 95954
ph: 530.645.4040 x222 fax: 530.645.4040
[EMAIL PROTECTED] - [EMAIL PROTECTED]
http://bighead.net/ - http://eventpix.com/

On Apr 28, 2006, at 7:06 AM, Robert Garcia wrote:

ok, I am lying in bed, after hours of testing with php-gd, and php- imagemagick methods, looking for the best performance and such, and reflecting on my witangomagick bean. Thinking about the elapsed times of my tests, and really bummed about the blob method. Then it dawns on me, and I am really excited I have to get to my mac, and feel stupid at the same time.....

I spent a year, slowly at first, then a good 4-6 months, researching various image libraries to replace quicktime for the desktop software I write for photographers. Must be fast, flexible, cross platform, etc.

One of the main aspects of my software, is it has to do a bunch of scaling of really big digital camera files, including raw, into jpegs. I wanted this as optimized as possible. So I worked out the methods for extracting jpegs from raw files, cuz they are in there, and so forth. I also was reading up on the opensource jpeg and tiff libraries when I found a reference in the jpeg library.

The jpeg library can be hinted to the size you need of the jpeg you wish to open. It is sort of like on the fly scaling, but it takes no time at all.

In other words, if I have this monster 3000x2000 6mp file, and I just need a 500x500 thumb, I have to open the entire image, which is uncompressed, and takes like 40megs of ram in most apps, and scale all 6 million pixels. My tests with my bean, are as fast as they can be, about 800ms to do this with the inpath, outpath, width, height method using jmagick. Imagemagick convert takes slightly longer, and im convert from witango about 900ms.

Now, if you hint the jpeg library as to what size image you need, it uses a special algorith to get you the image you need, but a bit bigger, cuz it has to do it factors of like 64 or something, I don't remember. But if you need a 500x500 image, and you hint the jpeg lib, then it returns say a 7xx-x-5xx image, and it takes the same time it would as if it was opening a real 7xx-x-5xx image. It has to do with the jpeg format stores data, and why you can have a progressively loading jpeg. So anyway, ImageMagick support this hinting. It is NOT documented anywhere, as far as I know, I just stumbled on it.

You can see what I mean, by doing a convert of a big image to a small thumb, normally, you would do something like this:

convert -thumbnail 150x150 infile.jpg outfile.jpg

see how long that takes.

Now try this:

convert -size 150x150 -thumbnail 150x150 infile.jpg outfile.jpg

It will return so fast, you will think it didn't work. The speed is increase is proportional to the factor of the size you need. If the image is 3000x2000, and you need to do the above, and get a 2400x1200 image, it will be faster, but not much. But when you go from 6mp, to 150x150, it will be around 10x as fast.

NOTE: this hinting helps with tiffs, in my testing, but jpegs is the only format with dramatic speed increase.

All that to say, my witangomagick bean, I have updated with these hints, using the jmagick methods. Here are my test results.

witangomagick bean file to file method, 6mp image to 150x150 = ~800ms UNhinted, and ~130ms hinted.

Witangomagick blobtoblob method ~1500ms unhinted, and 1100ms hinted. This is because there is something in the witangobeanhandler that is slowing the blob data into the bean method, can't help that, it should be as fast or faster.

Old method, using convert as external action from witango, ~ 900ms unhinted and ~300ms hinted. This is where you see how much more efficient a bean is in witango.

And I added a new method, file2blob, did not try unhinted, 100ms hinted! This last method, takes a filepath in, and returns a base64 string to witango. I included the time to encode/decode the base64 strings in blob methods in my timers. This last method shows you, how much faster the all blob method COULD be, if witango could push the blob into the bean fast enough.

Because I am using a large image, the witango bean handler chokes on the large amount of data, but the blob method may be the faster when dealing with larger images.

Now that I have these results, I am going to be rewriting the bean, as an imagemethod bean, not just for witango, so I can use in zend/php also. And it should be compatible with any environment that can call a bean.

With that said, I will probably spend more time, adding rotate, and flip, and other various methods to it, and organizing it better, and then release it as shareware, and maintain it myself.

If you are interested in helping me test it, email me off list, and I will send you a copy in a day or two, with my test taf so you can see how to execute it. It is extremely simple, you install the bean in your witango environment, and create the object:

<@if "<@var local$witangomagick type=text> contains 'Object'">
<@else>
<@assign local$witangomagick '<@CREATEOBJECT OBJECTID="witangomagick" TYPE="JavaBean">'>
</@if>

And here is how I call the file method with error checking:

<@assign local$output '<@callmethod local$witangomagick method="IM_thumbfile('<@webroot>witango_imagemagick \image.jpg','<@webroot>witango_imagemagick\out.jpg',150,150)">'>
<@ifequal '<@left str="<@var local$output>" numchars="6">' 'Error:'>
<@assign local$res "<@var local$output>">
<@else>
<@assign local$res "Success!">
</@if>

BTW, I have never made ANY money on some of the donateware or shareware stuff I have done, I only do it to recoup some of my cost in development.

--

Robert Garcia
President - BigHead Technology
VP Application Development - eventpix.com
13653 West Park Dr
Magalia, Ca 95954
ph: 530.645.4040 x222 fax: 530.645.4040
[EMAIL PROTECTED] - [EMAIL PROTECTED]
http://bighead.net/ - http://eventpix.com/

On Apr 26, 2006, at 1:35 PM, Ben Johansen wrote:

Ok,
To address easy, here is the code to for the image test.

In short this is basically a web service. The test we ran used Witango to
generate the table and the <IMG SRC=> called this php code

Notice all it took was one call to header function and then echo the data

(A neat thing in PHP is the header() function, no more having to mess with having to create the entire header, or trying to get the length right)

<pre>

<?php
$mysqli = new mysqli('host-name-here', 'user-name-here', 'user- pass-here',
'db-name-here');
if ($mysqli)
{
$query = "select thumb from image where guid='$_REQUEST[guid]'";
if ($result = $mysqli->query($query)) {
   if ($row = $result->fetch_row()) {
                $thumb = $row[0];
   }
   $result->close();
}
$mysqli->close();
header('Content-Type: image/jpeg');
echo $thumb;
}
?>

</pre>

Hey, I posted this to show actual code for the test. Remember one thing
guys, you can work with many diff environments together.

We have millions of images that need to be presented to our customers, so we are doing all we can to find the fastest way to do this and handle the
growth

Ben


-----Original Message-----
From: Rick Sanders [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 26, 2006 11:07 AM
To: [email protected]
Subject: RE: Witango-Talk: Probably my last code contribution

Hey Robert,

Apples and Oranges my friend! I find cold Fusion easier, and I like that
develop with it straight in Dreamweaver.

It has a lot of unique features. Yes, there's tons of PhP code out there,
there's also a lot of CF code too.

I still love WiTango, just can't get my clients to buy into the technology. I keep getting the same question, "If it's been around since 1996, why
haven't I heard of it?".


Rick Sanders
President
902-401-7689
www.webenergy-sw.com



-----Original Message-----
From: Robert Garcia [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 26, 2006 2:57 PM
To: [email protected]
Subject: Re: Witango-Talk: Probably my last code contribution

Oh yeah, the google effect has a huge effect on the learning curve.
You can find php code on anything you can think of, and start there.
Try that with witango. It is better with CF, but it is amazing how
much is available for php, and especially php/mysql.

As far as enterprise level, look here: http://public.yahoo.com/ ~radwin/

As far as power, here is a presentation about php-gd, a C based
graphic library as a module in php. And it doesn't require any
compiling. This is just one thing, but gives a good idea.

http://www.nyphp.org/content/presentations/GDintro/

To install gd on my FC5 apache/php machine, this is what it took.

sudo yum install php-gd

Then I restarted apache, and gd was ready and available in php.

--

Robert Garcia
President - BigHead Technology
VP Application Development - eventpix.com
13653 West Park Dr
Magalia, Ca 95954
ph: 530.645.4040 x222 fax: 530.645.4040
[EMAIL PROTECTED] - [EMAIL PROTECTED]
http://bighead.net/ - http://eventpix.com/

On Apr 26, 2006, at 9:43 AM, William M Conlon wrote:


On Apr 26, 2006, at 9:11 AM, Rick Sanders wrote:

My 2 cents,



PhP is a long learning curve and isn't powerful at all. Many sites
use it because it's free. Coding takes forever, and it's a
scripting engine that parses script, then executes it.

But it does have PEAR and an ever expanding codebase that you can
use.  Realistically, even with the builders, which are ancient and
do not implement best practices, every witango project starts from
scratch.  Of course we all have a bag of tricks to use, but what
about new shops?

And Witango is a scripting engine, too, and though it caches code,
it doesn't to my knowledge compile it.  Does the witango cacher
even discard anything extraneous, like comments?

Anyway, I've found php to be very easy to use.  I never even bought
an O'Reilly book, and have done a complete witango app conversion
(someone else's) in BBEdit -- without Zend.  Of course, I wouldn't
claim to have 'learned' php, so you're right about the lengthy
learning curve.  And there is a LOT to like with witango compared
to php -- especially variable scopes.


Compared to Cold Fusion, Cold Fusion beats it hands down in
performance and time it takes to code. Cold Fusion has superior
XML integration, and OS integration. Anyone looking at a second
programming language should look at Cold Fusion. It's a much
easier learning curve than PhP.



MySQL has come a long way, but is still not a good platform for
enterprise applications. Microsoft SQL server 2005 ties into
Windows server 2003, and is the fastest database on windows. If
you're into Linux, Pervasive is 30% faster than MySQL. And,
Pervasive has a free open source database too: http://
www.pervasivepostgres.com/

Don't know about PervasiveSQL, but Postgres is definitely not
faster than MyISAM.  If you don't need Stored Procedures,
referential integrity, or transactions, mySQL is hard to beat.  (I
know mySQL 5 is adding SP, and the InnoDB tables support
transactions, but my apps are still on 3.23 and 4.1).  If you do,
then Postgres is the way to go.
<image001.jpg>

Rick Sanders
President
902-401-7689
www.webenergy-sw.com

From: John McGowan [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 26, 2006 11:42 AM
To: [email protected]
Subject: Re: Witango-Talk: Probably my last code contribution



Robert,

I have no problem with your post(s).  I find it disturbing that
you still haven't received documentation on the Witango JavaBean
Interface.  For clarification though, was your request completely
ignored?  Or were you at least told something about why they can't
or won't give you what you're looking for.

If anybody out there has something they'd like to share positive
or NEGATIVE.  Please share it.   Last time I checked, this was an
open forum about Witango.  Information about how Witango is
outperformed 3X by PHP is absolutely relevant information and
should be addressed.

/John

DB1 CB14 wrote:

Robert,
I am not sure why you keep posting these types of email.  I have
read your posts about moving to PHP and MySQL and how you don't
like Witango anymore but many of us do not want to learn PHP and
really like the way Witango ties everything together for us.

It is your choice to move to another platform and it is my choice
to stay with Witango.  If you no longer wish to use Witango that
is fine but please move on quietly and stop beating up on the
product.  When Scott Cadillac moved to .Net he did it quietly and
professionally and he seems to still be on the list and drops us
some words of wisdom from time to time.  You seem to be want to
punish Witango Inc for some reason.

If you are really concerned about putting the code into open
source just create a project on sourceforge like Jason did with
his crontab taf.

Just my 2 cents worth.


Rds

Dave Breaker








How low will we go? Check out Yahoo! Messenger's low PC-to-Phone
call rates.

__________________________________________________________________ ___
___TO UNSUBSCRIBE: Go to http://www.witango.com/developer/
maillist.taf
__________________________________________________________________ ___
___ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/
maillist.taf

Bill

William M. Conlon, P.E., Ph.D.
To the Point
345 California Avenue Suite 2
Palo Alto, CA 94306
   vox:  650.327.2175 (direct)
   fax:  650.329.8335
mobile:  650.906.9929
e-mail:  mailto:[EMAIL PROTECTED]
   web:  http://www.tothept.com

___________________________________________________________________ ___
__
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf


____________________________________________________________________ ____
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

____________________________________________________________________ ____
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf


____________________________________________________________________ ____
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf





--

Robert Garcia
President - BigHead Technology
VP Application Development - eventpix.com
13653 West Park Dr
Magalia, Ca 95954
ph: 530.645.4040 x222 fax: 530.645.4040
[EMAIL PROTECTED] - [EMAIL PROTECTED]
http://bighead.net/ - http://eventpix.com/

_____________________________________________________________________ ___ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/ maillist.taf

______________________________________________________________________ __ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Bill

William M. Conlon, P.E., Ph.D.
To the Point
345 California Avenue Suite 2
Palo Alto, CA 94306
   vox:  650.327.2175 (direct)
   fax:  650.329.8335
mobile:  650.906.9929
e-mail:  mailto:[EMAIL PROTECTED]
   web:  http://www.tothept.com

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to