Yii Framework Forum: different serialization - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

different serialization

#1 User is offline   dckurushin 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 392
  • Joined: 16-March 11
  • Location:Israel

Posted 13 September 2011 - 04:12 PM

There is some very cool serialization alternatives out there, the coolest is igbinary, it much faster an save space...
It would be cool if there will be an option to switch serialization function...

maybe in main app config... serialize or json_encode, or igbinary etc.
Don't sure if it will save much time, but maybe at least space
0

#2 User is offline   Da:Sourcerer 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,222
  • Joined: 30-March 11
  • Location:Berlin, Germany

Posted 13 September 2011 - 06:25 PM

Fore reference: I think this is referring to this project.

Well, it looks promising. The only problem I see so far is that igbinary is producing binary output. That's a bit hard to debug and some components (CDbHttpSession and CDbCache) will need adjustment to cope with the binary format. Anyway: Thanks for the hint.
programmer /ˈprəʊgramə/, noun: a device that converts ►coffee into ►code
0

#3 User is offline   ekerazha 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 526
  • Joined: 10-October 08
  • Location:European Union

Posted 14 September 2011 - 06:13 AM

I would stick to serialize or json... maybe you could benchmark them (both serialize/unserialize json_encode/json_decode and use the faster one).
Yii user #37
0

#4 User is offline   dckurushin 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 392
  • Joined: 16-March 11
  • Location:Israel

Posted 14 September 2011 - 08:54 AM

I did a little benchmark, I tested var_export with return cache, serialization, json_encode, igbinary...

igbinary kick *ss :lol: he is about twice faster than all the variations, and he saves about 50% space. if serialization result take 80, igbinary would produce 40...
I hope I dont lay to you... it was half year ago.. now I use only igbinary...

I did a little tutorial for caching main.php
there you have the example and reference to github , as Sourcerer posted

http://www.yiiframew...onfig-main-php/
0

#5 User is offline   Da:Sourcerer 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,222
  • Joined: 30-March 11
  • Location:Berlin, Germany

Posted 15 September 2011 - 03:03 AM

I actually managed to find a very recent benchmark. At the same time I've been experimenting a bit with compressed sessions, resulting in a more general compression approach (it's not ready for a patch, yet). In my experience, the output of PHP's native serialize() compresses really well. Serialized data passed through gzip/lzf tends to be even smaller than igbinary's output. However, it will add some CPU overhead. I'll have to run some benchmarks but my guess is: igbinary is the faster approach while gzip(serialize()) leads to smaller sessions.
programmer /ˈprəʊgramə/, noun: a device that converts ►coffee into ►code
0

#6 User is offline   ekerazha 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 526
  • Joined: 10-October 08
  • Location:European Union

Posted 16 September 2011 - 05:59 AM

I'd would use a human readable approach, not some non-standard binary approach.
Yii user #37
0

#7 User is offline   Da:Sourcerer 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,222
  • Joined: 30-March 11
  • Location:Berlin, Germany

Posted 08 June 2012 - 05:02 AM

Oh, here's that thread :lol:

Just a small addition: Set igbinary.compact_strings to Off for a greater speed benefit. This will result into larger serialization strings (don't worry, they're still smaller than PHP's serialize() output). But I've found that the speed advantage is lost in a lot of circumstances.
programmer /ˈprəʊgramə/, noun: a device that converts ►coffee into ►code
0

#8 User is offline   kernel 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 91
  • Joined: 22-November 10

Posted 10 June 2012 - 10:04 PM

I think the point is to support different serializer to drop in , adapt in, not on which is better and faster.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users