Hi.

I have some, probably, very basic questions. :D

I'm making an engine, which will be script driven.
But I'm concerned with the performance of plain text, even if it was loaded to the memory.

I want the scripts to be executable very fast, since there would be a lot of them.

So I heard some people make a compiler for their scripts.
How does that work?:

* What would I want to input to the compiler, to make the binary files?
* How would I use those binary files, as in handling them from my main code?
* And what makes it improve performance?

I hope someone would be able to learn me something here :)
Thank you.

Assuming your data is in structures, fread and fwrite them. But...

Q: How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?

A: The most portable solution is to use text files (usually ASCII), written with fprintf and read with fscanf or the like. (Similar advice also applies to network protocols.) Be skeptical of arguments which imply that text files are too big, or that reading and writing them is too slow. Not only is their efficiency frequently acceptable in practice, but the advantages of being able to interchange them easily between machines, and manipulate them with standard tools, can be overwhelming.

If you must use a binary format, you can improve portability, and perhaps take advantage of prewritten I/O libraries, by making use of standardized formats such as Sun's XDR (RFC 1014), OSI's ASN.1 (referenced in CCITT X.409 and ISO 8825 ``Basic Encoding Rules''), CDF, netCDF, or HDF. See also questions 2.12, 12.38, and 12.42.

http://clusty.com/search?query=site%3Ac-faq.com%20binary%20text

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.