[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] Camlp4 Stack_overflow

I've rewritten the generated code so that it creates an array and then
assigns to indexes of the array, batching the assignments using
multiple let () =

Compilation speed is a problem, and it still falls over at 50K entries.

I suppose I could somehow write the data to an image and read it back
in at application startup, but I think I actually like my current
approach. All of the work is done at compilation time. The rows are
written in sorted order so a simple binary search can be used. The
resulting application is entirely single-purposed.

Any ideas for other ways to do this? Bypass the compiler and "compile"
the data myself? Does there exist tools to do something like that?

On Wed, May 7, 2014 at 1:40 PM, Andrà NÃss <andre.naess@xxxxxxxxx> wrote:
> Hi
> I'm trying something that might be a bit silly but it's just intended
> as an internal demo of Mirage to my team. I'm writing a tiny HTTP
> based application whose only purpose is to allow you to search a phone
> book.
> I've based my approach on the approach you've used for static websites
> using crunch where you compile the web pages into the executable. In
> my case that means I take the list of name and number pairs and stuff
> them into an array. So part of my config.ml file emits a single Pb.ml
> file which contains an array declaration like this:
> let db = [|("Aaron Jaksic",1571268);
> ("Aaron Mcdivitt",1454629);
> ("Aaron Reuben",1765247);
> ("Aaron Sardinha",1224806);
> ("Abbey Gowens",1267083);
> ("Abbey Hathcox",1309490);
> ...
> As the title say I'm running into problems compiling this when I
> create a large phone book, the error being:
> Camlp4: Uncaught exception: Stack_overflow
> This happens with 25K entries, it works with 10K entries.
> Is there some way I can prevent Camlp4 from being run on the Pb.ml
> file? Or will I just have to generate a file that builds the array at
> runtime somehow?
> AndrÃ

MirageOS-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.