# Caching by Marshal

**URL:** <https://www.ruby-forum.com/t/caching-by-marshal/70451>\
**Category:** Radiant CMS\
**Created:** [September 29, 2006, 9:19am UTC](https://www.ruby-forum.com/t/caching-by-marshal/70451 "2006-09-29T09:19:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keita\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ed8c4c/32.png) [@Keita\_Y](https://www.ruby-forum.com/u/Keita_Y)\
**Post date:** [September 29, 2006, 9:19am UTC](https://www.ruby-forum.com/t/caching-by-marshal/70451/1 "2006-09-29T09:19:25Z")

</div>

Hi,

Radiant uses YAML for caching pages, but I think Marshal is better. I  
recommend Marshal because YAML has a problem of handling multi-byte  
characters and YAML is slower than Marshal. I attached the patch for  
using Marshal, this works fine in my environment.

1. multi-byte characters problem

I experienced a problem that pages including japanese characters were  
broken. This is the same as “[Radiant] Cache problems” by bodhi.  
(see  
[http://www.mail-archive.com/removed\_email\_address@domain.invalid/msg00660.html](http://www.mail-archive.com/removed_email_address@domain.invalid/msg00660.html))

When I try Marshal for caching, pages including japanese characters are  
fine.  
I think YAML has a problem of handling multi-byte characters.

1. YAML is slower than Marshal

I compared YAML and Marshal performance by runing “test.rb”(attached  
this mail), the result is

YAML(dump):8.319402  
Marshal(dump):0.323576  
YAML(load):1.252383  
Marshal(load):0.374623

I think caching by YAML has no advantage(excuding debug?). Maybe it  
would be better to replace YAML by Marshal or use Marshal in  
production environment.

* * *

Keita Yamguchi

---

<div class="post-metadata">

**Author:** ![Keita\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ed8c4c/32.png) [@Keita\_Y](https://www.ruby-forum.com/u/Keita_Y)\
**Post date:** [September 29, 2006, 3:50pm UTC](https://www.ruby-forum.com/t/caching-by-marshal/70451/2 "2006-09-29T15:50:23Z")

</div>

This is excellent. Can you update the unit tests to reflect this change?  
Bodhi, would you have time to verify the performance statistics and make  
sure this makes it into the core?

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)
