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
_gambit.php code generation problem #173
Comments
It seems there are two repeated definitions in _univlib.scm, so I commented them out as so: '(define-prim (##os-device-tty-history-max-length-set! . rest) '(define-prim (##os-device-tty-history-set! . rest) Then I ran it but got thousands of "notices", e.g., heine:~/programs/gambit/gambit> php crap.php No clue what's going on. heine:~/programs/gambit/gambit> php -v |
Try adding this at the top of crap.php: error_reporting(E_ALL ^ E_NOTICE); Did you add the link file in front of crap.php ? |
On 01/21/2016 02:26 PM, Marc Feeley wrote:
Wow, when I add that as the second line, so the top of crap.php looks like php crap.php Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits 10, CPU time: .0019999999999999983. Last 5 digits 26535. Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits 100, CPU time: .009000000000000001. Last 5 digits 70679. Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits 1000, CPU time: .249. Last 5 digits 1989. Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits 10000, CPU time: 24.024. Last 5 digits 75678. Man is php slow! Here it is in javascript: heine:~/programs/gambit/gambit> nodejs crap.js Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits 10, CPU time: .009999999999999995. Last 5 digits 26535. Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits 100, CPU time: .006000000000000005. Last 5 digits 70679. Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits 1000, CPU time: .031. Last 5 digits 1989. Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits 10000, CPU time: .902. Last 5 digits 75678. > Did you add the link file in front of crap.php ? This is what I did: heine:~/programs/gambit/gambit> !gsc gsc -:=. -warnings -target php -link chud2.scm heine:~/programs/gambit/gambit> !cat cat chud2_.php chud2.php lib/_gambit.php > ! crap.php heine:~/programs/gambit/gambit> php crap.php |& head PHP Notice: Use of undefined constant g_bb1_real_2d_time_2d_milliseconds - assumed 'g_bb1_real_2d_time_2d_milliseconds' in /home/lucier/programs/gambit/gambit/crap.php on line 421 PHP Notice: Use of undefined constant g_bb1_println - assumed 'g_bb1_println' in /home/lucier/programs/gambit/gambit/crap.php on line 869 PHP Notice: Use of undefined constant g_bb1__20_chud2 - assumed 'g_bb1__20_chud2' in /home/lucier/programs/gambit/gambit/crap.php on line 1723 PHP Notice: Use of undefined constant g_bb1__20_chud2 - assumed 'g_bb1__20_chud2' in /home/lucier/programs/gambit/gambit/crap.php on line 1724 PHP Notice: Use of undefined constant g_bb1_cpu_2d_time - assumed 'g_bb1_cpu_2d_time' in /home/lucier/programs/gambit/gambit/crap.php on line 1853 PHP Notice: Use of undefined constant g_bb1_ch_2d_split - assumed 'g_bb1_ch_2d_split' in /home/lucier/programs/gambit/gambit/crap.php on line 9446 PHP Notice: Use of undefined constant g_bb1_pi - assumed 'g_bb1_pi' in /home/lucier/programs/gambit/gambit/crap.php on line 12168 PHP Notice: Use of undefined constant g_bb1__20_chud2 - assumed 'g_bb1__20_chud2' in /home/lucier/programs/gambit/gambit/crap.php on line 12230 PHP Notice: Use of undefined constant g_bb1__20___gambit - assumed 'g_bb1__20___gambit' in /home/lucier/programs/gambit/gambit/crap.php on line 14440 PHP Notice: Use of undefined constant g_bb1__20___gambit - assumed 'g_bb1__20___gambit' in /home/lucier/programs/gambit/gambit/crap.php on line 14441 |
Ha! Yes PHP is slower than JS by roughly an order of magnitude. Of course PHP wasn't exactly conceived as a language for number crunching. How long will it take for a million digits? Sounds like it will be around one hour. That will certainly put you in the record books! |
I don't know, there's a gmp module for php, search for gmp here: http://us3.php.net/manual/en/indexes.functions.php Brad |
Here are times for chud2.scm computing various numbers of digits of pi in php. Very ugly. firefly:~/programs/gambit/gambit> php crap.php This is on my i7 at home using the "fast" algorithms. |
With the current gsc:
Result:
heine:~/programs/gambit/gambit> php crap.php
PHP Fatal error: Cannot redeclare g_bb1__23__23_os_2d_device_2d_tty_2d_history_2d_max_2d_length_2d_set_21_() (previously declared in /home/lucier/programs/gambit/gambit/crap.php:479628) in /home/lucier/programs/gambit/gambit/crap.php on line 479684
It seems to be real:
function g_bb1__23__23_os_2d_device_2d_tty_2d_history_2d_max_2d_length_2d_set_21_() {static $id = 0, $parent = NULL, $nfree = -1, $name = "##os-device-tty-history-max-length-set!", $ctrlpts = array("g_bb1__23__23_os_2d_device_2d_tty_2d_history_2d_max_2d_length_2d_set_21_"), $info = false; // entry-point (+rest) <============== line 479628
global $g_null_obj, $g_r1, $g_nargs, $g_cst1799___gambit, $g_pollcount;
if ($g_nargs == 0) {
$g_r1 = $g_null_obj;
} else {
if (!g_build_rest(0)) {
return g_wrong_nargs(g_bb1__23__23_os_2d_device_2d_tty_2d_history_2d_max_2d_length_2d_set_21_);
}
}
$g_r1 = $g_cst1799___gambit;
if (--$g_pollcount == 0) {
return g_poll(g_bb2__23__23_os_2d_device_2d_tty_2d_history_2d_max_2d_length_2d_set_21_);
} else {
$g_nargs = 1;
if (--$g_pollcount == 0) {
return g_poll(g_bb1_error);
} else {
return g_bb1_error;
}
}
}
and
$g_peps["##os-device-tty-history-max-length-set!"] = g_bb1__23__23_os_2d_device_2d_tty_2d_history_2d_max_2d_length_2d_set_21_;
function g_bb1__23__23_os_2d_device_2d_tty_2d_history_2d_max_2d_length_2d_set_21_() {static $id = 0, $parent = NULL, $nfree = -1, $name = "##os-device-tty-history-max-length-set!", $ctrlpts = array("g_bb1__23__23_os_2d_device_2d_tty_2d_history_2d_max_2d_length_2d_set_21_"), $info = false; // entry-point (+rest)
global $g_null_obj, $g_r1, $g_nargs, $g_cst1800___gambit, $g_pollcount;
if ($g_nargs == 0) {
$g_r1 = $g_null_obj;
} else {
if (!g_build_rest(0)) {
return g_wrong_nargs(g_bb1__23__23_os_2d_device_2d_tty_2d_history_2d_max_2d_length_2d_set_21_);
}
}
$g_r1 = $g_cst1800___gambit;
if (--$g_pollcount == 0) {
return g_poll(g_bb2__23__23_os_2d_device_2d_tty_2d_history_2d_max_2d_length_2d_set_21_);
} else {
$g_nargs = 1;
if (--$g_pollcount == 0) {
return g_poll(g_bb1_error);
} else {
return g_bb1_error;
}
}
} <============================== line 479684
The text was updated successfully, but these errors were encountered: