Haxe serializer speed

The serializing feature of Haxe can be very handy - for example using Haxe Remoting in a flash game to communicate with your server, Haxe objects are automatically serialized on the client (converted to textual form), sent over to the server, and unserialized to object form. However the speed of serializing does matter.

The serializer not only serializes the object passed to it, but also automatically follows and serializes references to other objects. As an example, if you pass the root element of a tree structure for serialization, it will follow the links to the child nodes and as a result serialize the whole tree. This is very fine, but if the objects contain cyclic references - like child nodes linking back to their parents - the serializer would run into an endless loop.

For avoiding this, the serializer has an option called useCache, which when turned on, the serializer keeps a memory of previously met objects and won't re-serialize them. Unfortunately, for technical reasons the lookup of an object in this memory takes O(n) time, n being the number of objects met while serializing, so the full serializing takes O(n^2) time.

This means that if you are keen on speed, you must not use the useCache option, and take care of serializing structures without cyclic references. And, unconvenient as it is, but sometimes you may have to consider going down to the level of (un)serializing by hand, which would enable for highly tuned speed.

Comments

  
Remember personal info?

Emoticons / Textile

To prevent automated commentspam we require you to complete this silly task.
 

  (Register your username / Log in)

Notify:
Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.

About

Flash game development using HaXe and pals.

Archives

01 Nov - 30 Nov 2009
01 Oct - 31 Oct 2009
01 Sep - 30 Sep 2009
01 Jul - 31 Jul 2009
01 May - 31 May 2009
01 Apr - 30 Apr 2009
01 Mar - 31 Mar 2009
01 Feb - 28 Feb 2009
01 Jan - 31 Jan 2009
01 Dec - 31 Dec 2008
01 Nov - 30 Nov 2008
01 Oct - 31 Oct 2008
01 Sep - 30 Sep 2008
01 Aug - 31 Aug 2008
01 Sep - 30 Sep 2007

Calendar

« September 2010
S M T W T F S
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    

Linkdump

Game design document - §

If you are about to create a new game, be sure to read this nice article along with its predecessors.

09.11.24. 13:29 | comment!

VelociRapid game element preview - §

Click the banner to play a preview of prey fleeing, and also take a peek underneath to see the quadtree space partitioning (nodes do not collapse right now). WSAD to control the dino.

09.11.19. 23:18 | comment!

Gambit's response to recent virtual currency changes - §

An interesting read at the Gambit blog.

09.11.05. 10:19 | comment!

Dirty coding tricks of game developers - §

Read it at Gamasutra

09.11.03. 10:02 | comment!

Payment providers - §

Some alternative payment providers for running your own virtual curreny system:

09.07.13. 21:38 | comment!

ssh tunneling in linux - §

To forward the local port X to the local port Y of the remote machine:

ssh -L X:127.0.0.1:Y remote.machine -N

Usage example: Setup a local web proxy (like privoxy) on a remote university machine, and connect to it from home. This way you can access university resources with ease.

09.05.14. 10:28 | comment!

Free flag images - §

http://www.33ff.com/flags/index.htm

09.04.08. 11:52 | comment!

Render text with ImageMagick - §

convert -font font.ttf -background none -geometry +0+0 -fill \#ffffff -pointsize 18 label:"`cat txt`" -set label '' out.png

09.04.02. 15:16 | comment!

Online Latex equation editor - §

Online latex is

09.03.11. 09:02 | comment!

Create swc from a tree of as3 files - §

V1 (thanks to Jarrad Hope!) compc -output my_swc.swc -include-sources .

V2 (the old and hacky :) cd tree_top; compc -source-path . -output my_swc.swc -include-classes `find . -regex .*as | awk '{gsub(/\.\//, "", $0); gsub(/\.as/, "", $0); print $0}'`

09.03.06. 09:58 | two comments

Delete first line from file - §

sed -i '1d' file.txt

09.02.18. 12:28 | comment!

Gentoo: check security holes - §

glsa-check -p $(glsa-check -t all)

09.02.04. 11:30 | comment!

Execution speedup with fifo - §

Speed up the execution of programs that generate massive unwanted log-files by sending those logs to null through a fifo: mkfifo logfile
cat logfile > /dev/null &
./myprogram -log logfile

09.01.19. 14:09 | comment!

ImageMagick PNG background and auto-crop - §

Set background to white and auto-crop with ImageMagick: for i in `ls *png`; do convert -flatten $i x.png; convert -trim x.png out_$i; done

09.01.12. 17:15 | comment!

Linux: split file on pattern - §

awk '/PATTERN/{i++}{print > "file.pdb."i}' file, found here

08.12.15. 17:46 | comment!

Replace in multiple files on Linux - §

perl -pi -w -e 's/search/replace/g;' *.php
Found here.

08.12.10. 10:42 | comment!

XPath in Python - §

A nice summary about options for xpath with python here.

08.12.09. 18:41 | comment!

Christmas Icons - §

Free Chrismtas Icons!

08.12.08. 11:46 | comment!

PS print on WinXP - §

Print to PS on WinXP without any printers! Cool :)

08.12.04. 12:59 | comment!

Sorry, OpenOffice - §

OpenOffice is simply a no-go. Ill UI, missing features. Go for Latex or Crossover Office instead.

08.12.02. 14:31 | comment!

Last Referrers

Miscellany

Powered by Pivot - 1.40.7: 'Dreadwind' 
XML: RSS Feed 
XML: Atom Feed