[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octave standalone-Programs runs too slowly
From: |
Tatsuro MATSUOKA |
Subject: |
Re: Octave standalone-Programs runs too slowly |
Date: |
Thu, 4 Jun 2015 07:55:57 +0900 (JST) |
----- Original Message -----
>From: Ilya Dubadenko
>To: help
>Date: 2015/6/4, Thu 03:05
>Subject: Octave standalone-Programs runs too slowly
>
>
>Hi!
>
>Why standalone octave program runs too slowly (more than 20 seconds for simple
>program)?
>How i can improve performance?
>
>Octave version: 4.0.0
>Platform: Windows 7 (x64)
>Machine: Core-i7, RAM 16Gb, 124 Gb SSD
>
>Here is my standalone.cc file (taken from
>http://www.gnu.org/software/octave/doc/interpreter/Standalone-Programs.html#Standalone-Programs):
>#include <iostream>
>#include <octave/oct.h>
>
>int
>main (void)
>{
> std::cout << "Hello Octave world!\n";
>
> int n = 2;
> Matrix a_matrix = Matrix (n, n);
>
> for (octave_idx_type i = 0; i < n; i++)
> for (octave_idx_type j = 0; j < n; j++)
> a_matrix(i,j) = (i + 1) * 10 + (j + 1);
>
> std::cout << a_matrix;
>
> return 0;
>}
>
>$ mkoctfile -I/c/ProgramData/Octave-4.0.0/include/octave-4.0.0/
>-I/c/ProgramData/Octave-4.0.0/include/octave-4.0.0/octave/
>-L/C/ProgramData/Octave-4.0.0/lib/
>-L/C/ProgramData/Octave-4.0.0/lib/octave/4.0.0/ --link-stand-alone
>standalone.cc
>-o standalone
>
>$ time ./standalone.exe
>Hello Octave world!
> 11 12
> 21 22
>
>real 0m20.560s
>user 0m0.000s
>sys 0m0.046s
>
I cannot reproduced the slowness.
I build standalone.exe from the code the above and execute the same test.
My environment is slower than you but execute time less than 2 seconds.
My environment
Windows 7 Home Premium 64 bit, Intel Core i5-2400 @3.10GHz, RAM 4GB.
*********************************************************************
First test
$ time ./standalone.exe
Hello Octave world!
11 12
21 22
real 0m1.460s
user 0m0.000s
sys 0m0.078s
Second test
$ time ./standalone.exe
Hello Octave world!
11 12
21 22
real 0m0.801s
user 0m0.031s
sys 0m0.047s
Third test
$ time ./standalone.exe
Hello Octave world!
11 12
21 22
real 0m0.794s
user 0m0.000s
sys 0m0.062s
Fourth test
$ time ./standalone.exe
Hello Octave world!
11 12
21 22
real 0m0.796s
user 0m0.000s
sys 0m0.078s
*********************************************************************
First test is slower than other tests.
Perhaps from the second test, cash effect reduced program initialization time.
Can you reproduce the slowness in iteration of tests?
Tatsuro