I wouldn't worry about the memory so much because the process running
the compiler is short-lived.
Regarding speed: It might help if you set some compiler options.
Especially turning of static analysis. I send an updated version which
does that.
Using an XML parser is only interesting if your data actually is XML, I
think.
It looks like you want to share a large value between different Oz
processes.
Did you try the "obvious" method:
- On the sender site:
Ticket = {Connection.offer LargeValue}
send Ticket through socket
- On the receiver site:
receive Ticket from socket
LargeValue = {Connection.take Ticket}
Cheers,
Wolfgang
Maity, Ashis K wrote:
Thanks Wolfgang! That appears to help some, but not by that much. It
still consumes quite a bit of memory for big problem (although I do not
see that spike in OZ profiler -- perhaps this being in different process
-- but I do see that in windows TaskManager) and processing time has
reduced a bit, but not dramatically. There is another alternative that
Denys is suggesting here
(http://lists.gforge.info.ucl.ac.be/pipermail/mozart-users/2003/003442.h
tml) about using XML parser. What do you think whether that will help
significantly? I guess I do not want to spend a lot of time on that if
you do not see much difference in that approach.
Ashis
-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Wolfgang Meyer
Sent: Thursday, May 07, 2009 2:23 PM
To: Mozart users
Subject: Re: Compiler.virtualStringToValue
Maity, Ashis K wrote:
Sorry -- looks like our smarty-pant firewall blocked your attachment
since it had extension .oz. Would you mind renaming it to
CompileData.allow and resend it?
Thanks again,
Ashis
Here you go.
BTW, you can also see all posts on the Web:
http://lists.gforge.info.ucl.ac.be/pipermail/mozart-users/2009/010923.ht
ml
Cheers,
Wolfgang
declare
%% Data as received by socket
%% (written as a virtual string here because Oz does not have multiline string
literals; but this does not matter to the problem)
TextualData =
"problem("#
" tasks:[ task_Label_100("#
" dur:8 priority:1 start:[102#102] taskType:[t_LESSON t_LECTURE
t_GAO t_FLIGHT_HRS t_TOT_TRAIN_HRS ] resources_used:[ru("#
"
id:[3979 ] num:1
resourceType:c_GEN_STUDENT"#
"
)"#
"
] "#
" )"#
" ]"#
""#
" pdc("#
" name:usagePerPeriodConstraint specificConstraints:sc("#
" taskType:t_LESSON
resourceType:c_GEN_INSTRUCTOR maxTime:160 periodLength:672 stepSize:720"#
" )"#
" )"#
")"
fun {CompileInSeparateProcess DataAsString}
TmpFileNameOz = "tempfile.oz" %% consider using a unique name here,
especially if you plan to call this function concurrently
TmpFileNameOzf = TmpFileNameOz#"f"
TmpFile
CompiledData
ExitCode
CompilerExec =
"ozc --nostaticanalysis --nowarnredecl --nowarnshadow --nowarnunused
--nowarnunusedformal --nowarnforward -c"
in
%% write data
TmpFile= {New Open.file init(name:TmpFileNameOz flags:[write text create
truncate])}
{TmpFile write(vs:DataAsString)}
{TmpFile close}
%% call compiler
ExitCode = {OS.system CompilerExec#" "#TmpFileNameOz}
{OS.unlink TmpFileNameOz} %% delete temporary file
if ExitCode \= 0 then raise couldNotCompileData(DataAsString) end end
CompiledData = {Pickle.load TmpFileNameOzf}
{OS.unlink TmpFileNameOzf}
CompiledData
end
in
{Browse {CompileInSeparateProcess TextualData}}
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users