Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

./harlanc test/hello.kfc took a very long time, is that normal? #110

Closed
muyinliu opened this issue Dec 6, 2013 · 9 comments
Closed

./harlanc test/hello.kfc took a very long time, is that normal? #110

muyinliu opened this issue Dec 6, 2013 · 9 comments

Comments

@muyinliu
Copy link

muyinliu commented Dec 6, 2013

@eholk I run the command "./harlanc test/hello.kfc" and it took over 2 minutes. But finally I got runnable file "hello". Is that normal? And why it took so long?

@eholk
Copy link
Owner

eholk commented Dec 6, 2013

Two minutes is a little long, but not abnormal. How much RAM do you have? Harlan uses the Nanopass framework, which unfortunately generates a lot of code at macro expansion time. Currently Harlan uses about 5GB RAM on my machine. If you have this much free, compilation takes about 40 seconds, which is better than 2 minutes, but still longer than I'd like. I'm working on a few options to reduce this.

#99 is related.

@muyinliu
Copy link
Author

muyinliu commented Dec 6, 2013

I use MacBook 516 which came out in 2010. Here is the profile:

Model Name:  MacBook
Model Type:  13-inch, Mid 2010
Model Identifier:  MacBook7,1
Processor Name:  Intel Core 2 Duo CPU P8600
Processor Model:  Penryn
Processor Speed:  2.4 GHz
Number of Processors:  1
Total Number of Cores:  2
Memory Size:  4 GB 1067 MHz DDR3
Graphics Model:  NVIDIA GeForce 320M 256 MB
Manufactured during:  May 2010
L1 Cache:  64 KB
L2 Cache:  3 MB
L3 Cache:  -
Processor Bitrate:  64 bit
EFI Bitrate:  64 bit
Kernel Bitrate:  64 bit
Bus Speed:  1.07 GHz
Boot ROM Version:  MB71.0039.B0E
System SMC Version:  1.60f6
Power Source:  AC Power. Fully charged.
Minimum Supported Operating System:  OS X 10.6.3 Build 10D2125 (Snow Leopard)
Current Boot Operating System:  OS X 10.9.0 Build 13A603 (Mavericks)
Maximum Supported Operating System:  Latest version of OS X 10.9 (Mavericks)

Here is the time records:

harlan$ time ./harlanc test/hello.kfc

real    2m55.865s
user    1m23.920s
sys 0m32.725s
harlan$ time ./harlanc test/hello.kfc

real    3m6.301s
user    1m23.739s
sys 0m32.437s
harlan$ time ./harlanc test/hello.kfc

real    1m57.516s
user    1m16.198s
sys 0m20.928s
harlan$ time ./harlanc test/hello.kfc

real    1m44.939s
user    1m11.048s
sys 0m18.169s

The last 2 record is under few application is still running. I closed most application to test.

The progress petite max memory is 2.67Gb, CPU seems always larger than 95%.

@eholk
Copy link
Owner

eholk commented Dec 6, 2013

Thanks for the info! Unfortunately, this is probably about the best we'll be able to do for a while.

For developing Harlan programs, you can try harlani. It gives you a shell that you can use to compile programs without having to stop and restart the compiler each time. This avoids paying the cost of compiling Harlan each time you want to compile a program written in Harlan.

@muyinliu
Copy link
Author

muyinliu commented Dec 6, 2013

Thanks for your tips. I try ./harlani on my MacBook, I got this error:

harlan$ ./harlani
Some useful options:
 (make-shared-object)  -- Compile to a shared library instead of an executable
 (harlan-library-path) -- Where Harlan finds imported libraries
 (harlan-runtime-path) -- Where Harlan finds its runtime files
 (verbose)             -- Make Harlan print detailed information
 (debug)               -- Generate debugging information
 (timing)              -- Display pass timing information

Compile a file with (compile "filename")
> compile test/hello.kfc

Exception in match: Unmatched datum with irritant compile

It seems didn't work?

And from #11, is that Vicare works well in OS X? I really want to try Vicare. I will make a report after trying.

@eholk
Copy link
Owner

eholk commented Dec 6, 2013

The harlani commands need to be in S-expressions. Try (compile "test/hello.kfc") instead.

On Fri, Dec 6, 2013 at 2:52 AM, muyinliu [email protected] wrote:

Thanks for your tips. I try ./harlani on my MacBook, I got this error:

harlan$ ./harlani
Some useful options:
(make-shared-object) -- Compile to a shared library instead of an executable
(harlan-library-path) -- Where Harlan finds imported libraries
(harlan-runtime-path) -- Where Harlan finds its runtime files
(verbose) -- Make Harlan print detailed information
(debug) -- Generate debugging information
(timing) -- Display pass timing information

Compile a file with (compile "filename")

compile test/hello.kfc

Exception in match: Unmatched datum with irritant compile

It seems didn't work?

And from #11 #11, is that Vicare
works well in OS X? I really want to try Vicare. I will make a report after
trying.


Reply to this email directly or view it on GitHubhttps://github.com//issues/110#issuecomment-29969907
.

@muyinliu
Copy link
Author

muyinliu commented Dec 6, 2013

(compile "test/hello.kfc") is okay, thanks.

Here is the record:

harlan$ ./harlani
Some useful options:
 (make-shared-object)  -- Compile to a shared library instead of an executable
 (harlan-library-path) -- Where Harlan finds imported libraries
 (harlan-runtime-path) -- Where Harlan finds its runtime files
 (verbose)             -- Make Harlan print detailed information
 (debug)               -- Generate debugging information
 (timing)              -- Display pass timing information

Compile a file with (compile "filename")
> (compile "test/hello.kfc")
#t
> (compile "test/hello.kfc")
#t
>

Every time compile only take few second, CPU less than 30% and less memory(about 500Mb of the progress petite).

@eholk
Copy link
Owner

eholk commented Dec 6, 2013

Awesome! I hope this works for now until we can get the regular harlanc
memory usage down.

Please keep playing around with this and feel free to ask about any issues
you run into. This is still a research project so there are likely to be
many issues, but I will do by best to address them promptly.

On Fri, Dec 6, 2013 at 11:03 AM, muyinliu [email protected] wrote:

(compile "test/hello.kfc") is okay, thanks.

Here is the record:

harlan$ ./harlani
Some useful options:
(make-shared-object) -- Compile to a shared library instead of an executable
(harlan-library-path) -- Where Harlan finds imported libraries
(harlan-runtime-path) -- Where Harlan finds its runtime files
(verbose) -- Make Harlan print detailed information
(debug) -- Generate debugging information
(timing) -- Display pass timing information

Compile a file with (compile "filename")

(compile "test/hello.kfc")
#t
(compile "test/hello.kfc")
#t

Every time compile only take few second, CPU less than 30% and less
memory(about 500Mb of the progress petite).


Reply to this email directly or view it on GitHubhttps://github.com//issues/110#issuecomment-30005380
.

@eholk
Copy link
Owner

eholk commented May 5, 2014

417059e includes some changes that make Harlan's memory usage significantly less. Hopefully this will help.

@eholk
Copy link
Owner

eholk commented Apr 28, 2015

6e789cc improves performance some more too. Compiling hello.kfc on my machine takes 8.5 seconds now. I'll continue to work on improving the compiler's performance, but I'm going to go ahead and consider this bug fixed.

Please let me know if you're still seeing multiple minute compile times though.

@eholk eholk closed this as completed Apr 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants