[FX.php List] Please help with slow code

Chris Hansen chris at iViking.org
Mon Jun 30 09:52:05 MDT 2014


Stephen,

So are you saying that if you perform a query via FAP without sorting, it returns quickly?  Is this the case with FX.php as well, or is it still slow?  If it's the sort that is slow, and you're only dealing with a couple hundred records, I'd absolutely perform the sort using PHP.

Also, not to be a broken record, but I've asked you twice to try the query using a different data type parameter (FMPro7 -- or 13 if you like -- rather than FMAlt).  This really can make a difference.

Best,

--Chris

On Jun 30, 2014, at 9:24 AM, Stephe Pocock <zippyaus at yahoo.com> wrote:

> Hi Chris
> 
> Thanks for the response.
> 
> I am not sure what is going on with my solution.
> 
> As i said, it worked fine under FM11 but under 12 and now 13 it is slow, 18 seconds to load 230 records.
> 
> Today, I re-wrote the page using the Filemaker php API, I used the same layout and the same find request return the original calculation fields.  The results are returned almost instantly.  The slowness with FM php is the sorting.
> 
> Thanks
> 
> Stephen
> 
> From: Chris Hansen <chris at iViking.org>
> To: Stephe Pocock <zippyaus at yahoo.com> 
> Sent: Monday, 30 June 2014 11:06 PM
> Subject: Re: [FX.php List] Please help with slow code
> 
> Hi Stephen,
> 
> So all three of the calculations were UN-stored calcs?  Well, if there's no way to create stored versions of the calculations (via periodically re-loaded lookups, for example), then doing the calc in PHP might be faster.  That said, it does seem odd that the performance was okay in FM 11 if that's the problem.
> 
> That brings me to the other possibility: FMAlt vs FMPro7.  The reason that FMAlt was introduced was that a bug was introduced in FMS12 related to portals and/or repeating fields as returned by a specific XML schema.  (Everything else works fine.)  The XML grammar used by FMAlt is much more verbose, and I have seen responses with it take twice as long to load (though typically the difference is quite a bit smaller.)  Are there portals and/or repeating fields on the layout in question, and if not, have you tried using FMPro7 as your data type?  (Note that you can use FMPro12 as the data type, too, but the output will be no different.)
> 
> Best,
> 
> --Chris
> 
> 
> 
> On Jun 29, 2014, at 10:25 PM, Stephe Pocock <zippyaus at yahoo.com> wrote:
> 
>> Hi Chris
>> 
>> There were 6 fields on the layout.
>> 
>> 3 calculations.
>> 
>> I have removed the calculations from the php page and layout and the page loads faster, but obviously does not have the required data.
>> 
>> The thing that bothers me is these are the same pages and setups that we have for Filemaker 11 and we never had the slow loads.
>> 
>> Are you suggesting that I not use calculations and do all of the calculations in php?
>> 
>> Thanks
>> 
>> Stephen
>> 
>> From: Chris Hansen <chris at iViking.org>
>> To: Stephe Pocock <zippyaus at yahoo.com>; FX.php Discussion List <fx.php_list at mail.iviking.org> 
>> Sent: Friday, 27 June 2014 12:21 AM
>> Subject: Re: [FX.php List] Please help with slow code
>> 
>> Hi Stephe,
>> 
>> A few questions:
>> 
>> 1) Are there many excess fields on the layout in question?
>> 
>> 2) Are there any summary or unstored calculation fields?
>> 
>> 3) Have you tried performing the query using data type FMPro7? (In this case any integer gte 7 will perform the same.)
>> 
>> Best,
>> 
>> --Chris
>> 
>> 
>> 
>> On Jun 26, 2014, at 3:10 AM, Stephe Pocock <zippyaus at yahoo.com> wrote:
>> 
>>> Hi
>>> 
>>> We pretty much use the same code for all our FX pages.  Ever since we moved from Filemaker 11 this has been a lot slower to load.
>>> 
>>> I use the latest FX.php and FMalt
>>> 
>>> I would greatly appreciate it if someone could review this code and let me know if there is anything out of the ordinary.
>>> 
>>> <?php
>>> 
>>> define('DEBUG', FALSE); 
>>> 
>>> include_once("../FX/FX.php");
>>> include_once("../FX/server_data.php");
>>> include_once("../FX/FMErrors.php");
>>> 
>>> $TitleID=$_REQUEST['Initial'];
>>> 
>>> $cat=new FX($serverIP,$webCompanionPort,'FMAlt');
>>> $cat->setDBData('FMOnline','TQS_Manual_PHP', 'ALL');
>>> $cat->SetDBUserPass ($webUN, $webPW); 
>>> $cat->AddDBParam('Initial',$TitleID);
>>> $cat->AddDBParam('Reference','FMP');
>>> 
>>> $cat->AddSortParam('Title','ascend');
>>> 
>>> $catResult=$cat->FMFind();
>>> foreach ($catResult['data'] as $key => $catData)
>>> 
>>> ?>
>>> 
>>> 
>>> <html>
>>> <head>
>>> <title>Forms, Manuals and Publications</title>
>>> 
>>> </head>
>>> 
>>> <body>
>>> <table width="600" border="0">
>>>  
>>> <?php
>>> $checkHeader = NULL;
>>> 
>>> foreach ($catResult['data'] as $key => $catData)
>>> {
>>> $Title = $catData['Title'][0];
>>> $URL = $catData['URL'][0];
>>> $target = $catData['c_URL_target'][0];
>>> 
>>> 
>>> echo "<tr valign='top'>\n
>>> <td width='20' height='15'>
>>>                 <div align='center'><img src='/Images/Bullet.png' width='9' height='12'>        </div></td>\n
>>> <td><a href='$URL' target='_blank'>$Title</a> </td>\n
>>> </tr>\n";
>>> 
>>> }
>>> // End the foreach loop
>>> ?>
>>> </table>
>>> 
>>> 
>>> </body>
>>> </html>
>>> 
>>> 
>>> 
>>> There are less than 100 records and it takes up to a minute to load.
>>> 
>>> We are using FMS13 on iis 2008R2.
>>> 
>>> Thanks in advance.
>>> 
>>> Stephen
>>> 
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>> 
>> 
>> 
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20140630/c830d195/attachment-0001.html


More information about the FX.php_List mailing list