Re: Speed comparison between vanilla pyyaml and yaml+libyaml
Anders Kaseorg <andersk-DPNOqEs/[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 22 Apr 2009, [email protected] wrote: > What bothers me is that there's a negligible difference in speed, even > with libyaml installed, and pyyaml using the cyaml extension: Are you sure that pyyaml is using the cyaml extension? You need to explicitly tell it to do so: - j = yaml.dump(raw) - yaml.load(j) + j = yaml.dump(raw, Dumper=yaml.CDumper) + yaml.load(j, Loader=yaml.CLoader) After such changes, I see a ~4x speedup. before: ser_yaml (6.870s) 623178 bytes ser_yaml_compressed (6.930s) 291042 bytes serde_yaml (19.660s) after: ser_yaml (2.120s) 623533 bytes ser_yaml_compressed (2.150s) 291208 bytes serde_yaml (5.100s) Anders ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p