Keyword

[SOLVED] K2 propriety JSON decode/encoding extremely slow.

  • Frank Witte
  • Frank Witte's Avatar Topic Author
  • Offline
  • New Member
More
13 years 7 months ago #94770 by Frank Witte
Hello,

 

Currently I a have K2 project which has like 60 extra fields defined. I have imported 1000+ items. When trying to open an item in the administrative dialog it is extremely slow to the point that it will time-out before producing the page.

 

Using a profiler I could narrow it down to the propriety JSON decoding function. If I replace that with the PHP (5.2.+) json_decode function, it performs normally.

 

The question is; Am I missing functionality if I do not use the propriety JSON functions?Or, are there other ways to improve performance?
Cheers.

Please Log in or Create an account to join the conversation.

More
10 years 10 months ago - 10 years 10 months ago #94771 by Filip
Believe it or no, problem is not solved until these days... Anyway, I gave up trying to figure out what is wrong and my conclusion is pretty much same as yours.
I have 4 textarea extrafields that can be large (large like they need longtext field type in database, I had to change that too). As soon as entries become 3-4 A4 pages of text approx - editing is stuck beyond time expiration for script execution. It goes up to 3 minutes, which noone normal will wait today!

File administrator/components/com_k2/lib/JSON.php, line around 497,
function decode($str) { 
....
}

Change whole that function in just
function decode($str)
{
   return json_decode($str);
}

This is if you use php 5.2+ and I suppose there's noone who doesn't today.
What I don't know is if this leaves some other consequences in therms something can not be decoded, since encode function is also K2 custom made. Maybe it can be replaced too, but for now I am not touching it. Everything started working lightning fast, like in 1 second or so...
I hope this helped, cheers!

never walk alone

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum